diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2015-10-18 06:12:38 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2015-10-18 06:12:38 +0300 |
commit | d459ec098320c69997912d8791d9d4b0ec471514 (patch) | |
tree | 511dcc94fdaf68f64962ca20ca0f54983903b9ef | |
parent | 9f92995f61a9221dce98d10a86271cf000a7c12e (diff) | |
parent | d5ffa502e26b574577f523e22476f23ec4567083 (diff) |
Merge pull request #114 from alexlafroscia/add-nvm-prompt-segment
Add nvm prompt segment
-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 |