aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2016-02-26 17:37:34 +0300
committerBen Hilburn <bhilburn@gmail.com>2016-02-26 17:37:34 +0300
commit5d31763a8eab213cdcf59d76283b34e75fd93d4d (patch)
treea75dd84282f8fefa21c168131d06a9601e180a01
parent2260b83c98ceec8dbf3d79bbc09452d8a20f22b1 (diff)
parent163ac2697c45a5438be5b89fb9af53f208c56a75 (diff)
Merge pull request #219 from rmad17/nodeenv-support
Adding `nodeenv` segment.
-rw-r--r--README.md1
-rwxr-xr-xpowerlevel9k.zsh-theme9
2 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index 59e45409..f9e48b05 100644
--- a/README.md
+++ b/README.md
@@ -95,6 +95,7 @@ The segments that are currently available are:
* [ip](#ip) - Shows the current IP address.
* **load** - Your machines 5 minute load average.
* **node_version** - Show the version number of the installed Node.js.
+* **nodeenv** - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name.
* **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.
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 37950e76..38651fe9 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -567,6 +567,15 @@ prompt_nvm() {
$1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
}
+# NodeEnv Prompt
+prompt_nodeenv() {
+ local nodeenv_path="$NODE_VIRTUAL_ENV"
+ if [[ -n "$nodeenv_path" && "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then
+ local info="$(node -v)[$(basename "$nodeenv_path")]"
+ "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON'
+ fi
+}
+
# print a little OS icon
prompt_os_icon() {
"$1_prompt_segment" "$0" "$2" "black" "255" "$OS_ICON"