diff --git a/README.md b/README.md index 8b8ad44..9652630 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ This theme is based loosely on [agnoster][agnoster]. * Current RVM, rbenv or chruby (Ruby) version * Current virtualenv (Python) version * _If you use virtualenv, you will probably need to disable the default virtualenv prompt, since it doesn't play nice with fish: `set -x VIRTUAL_ENV_DISABLE_PROMPT 1`_ - * Current NVM version (Nodejs) (inactive by default; see configurations in the next paragraph) + * Current NVM/FNM version (Nodejs) (inactive by default; see configurations in the next paragraph) * Abbreviated parent directory * Current directory, or Git or Mercurial project name * Current project's repo branch (branch-glyph master) or detached head (`➦` d0dfd9b) @@ -86,6 +86,7 @@ set -g theme_display_virtualenv no set -g theme_display_nix no set -g theme_display_ruby no set -g theme_display_nvm yes +set -g theme_display_fnm yes set -g theme_display_user ssh set -g theme_display_hostname ssh set -g theme_display_vi no @@ -125,6 +126,7 @@ set -g theme_newline_prompt '$ ' - `theme_display_ruby`. Use `no` to completely hide all information about Ruby version. By default Ruby version displayed if there is the difference from default settings. - `theme_display_nvm`. If set to `yes`, will display current NVM node version. +- `theme_display_fnm`. If set to `yes`, will display current FNM node version. - `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported. - `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator. - `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`). diff --git a/fish_prompt.fish b/fish_prompt.fish index e0a653e..1d9bda9 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -40,6 +40,7 @@ # set -g theme_display_sudo_user yes # set -g theme_display_vi no # set -g theme_display_nvm yes +# set -g theme_display_fvm yes # set -g theme_avoid_ambiguous_glyphs yes # set -g theme_powerline_fonts no # set -g theme_nerd_fonts yes @@ -909,6 +910,20 @@ function __bobthefish_prompt_nvm -S -d 'Display current node version through NVM set_color normal end +function __bobthefish_prompt_nvm -S -d 'Display current node version through FNM' + [ "$theme_display_nvm" = 'yes' -a -n "$FNM_DIR" ] + or return + + set -l node_version (fnm current 2> /dev/null) + + [ -z $node_version -o "$node_version" = 'none' -o "$node_version" = 'system' ] + and return + + __bobthefish_start_segment $color_nvm + echo -ns $node_glyph $node_version ' ' + set_color normal +end + function __bobthefish_prompt_nix -S -d 'Display current nix environment' [ "$theme_display_nix" = 'no' -o -z "$IN_NIX_SHELL" ] and return