1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-11 00:00:06 +00:00

Added nodeenv support

This commit is contained in:
rmad17 2016-02-26 16:33:19 +05:30
parent e0603314d5
commit 06dd26a0bd

View file

@ -556,22 +556,14 @@ prompt_nvm() {
$1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON' $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON'
} }
# NodeEnv Prompt
prompt_nodeenv(){
export NODE_VIRTUAL_ENV_DISABLE_PROMPT=1
ZSH_THEME_NODEENV_PROMPT_PREFIX="("
ZSH_THEME_NODEENV_PROMPT_SUFFIX=")"
if [ -n "$NODE_VIRTUAL_ENV" ]; then
if [ "`basename "$NODE_VIRTUAL_ENV"`" = "__" ] ; then # NodeEnv Prompt
# special case for Aspen magic directories prompt_nodeenv() {
# see http://www.zetadev.com/software/aspen/ local nodeenv_path="$NODE_VIRTUAL_ENV"
local name="[`basename \`dirname "$NODE_VIRTUAL_ENV"\``]" local node_version=$(node -v)
else if [[ -n "$nodeenv_path" && "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then
local name=`basename "$NODE_VIRTUAL_ENV"` "$1_prompt_segment" "$0" "$2" "black" "green" "$(node -v)" 'NODE_ICON' "$(basename "$nodeenv_path")"
fi fi
echo "$ZSH_THEME_NODEENV_PROMPT_PREFIX$name$ZSH_THEME_NODEENV_PROMPT_SUFFIX"
fi
} }
# print a little OS icon # print a little OS icon
@ -827,7 +819,7 @@ prompt_vi_mode() {
prompt_virtualenv() { prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV" local virtualenv_path="$VIRTUAL_ENV"
if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then
"$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "($(basename "$virtualenv_path"))" "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")"
fi fi
} }