diff options
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 11 |
2 files changed, 12 insertions, 0 deletions
@@ -77,6 +77,7 @@ The segments that are currently available are: * [ip](#ip) - Shows the current IP address. * **load** - Your machines 5 minute load average and free RAM. * **node_version** - Show the version number of the installed Node.js. +* **nvm** - Show the version of Node that is currently active, if it differs from the version used by NVM * **os_icon** - Display a nice little icon, depending on your operating system. * **php_version** - Show the current PHP version. * [rbenv](#rbenv) - Ruby environment information (if one is active). diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 6108a4eb..54542a0c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -755,6 +755,17 @@ prompt_php_version() { fi } +# Node version from NVM +# Only prints the segment if different than the default value +prompt_nvm() { + local node_version=$(nvm current) + local nvm_default=$(cat $NVM_DIR/alias/default) + [[ -z "${node_version}" ]] && return + [[ "$node_version" =~ "$nvm_default" ]] && return + NODE_ICON=$'\u2B22' # ⬢ + $1_prompt_segment "$0" "green" "011" "${node_version:1} $NODE_ICON" +} + # rbenv information prompt_rbenv() { if [[ -n "$RBENV_VERSION" ]]; then |