Skip to content

Instantly share code, notes, and snippets.

@orestesgaolin
Created December 5, 2019 08:02
Show Gist options
  • Save orestesgaolin/09b33bbc46507bb675e333e64b0c299f to your computer and use it in GitHub Desktop.
Save orestesgaolin/09b33bbc46507bb675e333e64b0c299f to your computer and use it in GitHub Desktop.
.zshrc for fvm version in prompt
# place it somewhere in your .zshrc file e.g. just after setting the theme
# this is how I set powerlevel9k theme
# source /usr/local/opt/powerlevel9k/powerlevel9k.zsh-theme
# ZSH_THEME="powerlevel9k/powerlevel9k"
prompt_flutter() {
local flutter_version
flutter_version=$(command fvm flutter --version 2>/dev/null)
# Remove "Flutter " (including the whitespace) from the beginning
# of the version string and remove everything after the next
# whitespace. This way we'll end up with only the version.
flutter_version=${${flutter_version/Flutter /}%% *}
# there's no dedicated icon for Flutter, so I just used ETC_ICON which is cog wheel
if [[ -n "$flutter_version" ]]; then
"$1_prompt_segment" "$0" "$2" "dodgerblue1" "$DEFAULT_COLOR" "$flutter_version" 'ETC_ICON'
fi
}
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs flutter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment