aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex LaFroscia <alex@lafroscia.com>2015-10-12 07:28:33 +0300
committerAlex LaFroscia <alex@lafroscia.com>2015-10-14 02:08:36 +0300
commit7e6339ec2770bacc71ba83139330aec574f752f6 (patch)
tree1580a379cf9117d857fcd93059169e324ba50b09
parent62dee9824b6de724b4fa0d2b43c30fa194eb9280 (diff)
Add NVM prompt segment
Prints out the Node version that is currently active if it is different than the default version specified by NVM
-rwxr-xr-xpowerlevel9k.zsh-theme11
1 files changed, 11 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c2ee2625..af146d4e 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -752,6 +752,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