mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
added node version show
This commit is contained in:
parent
33100af0be
commit
44e9e2b20a
1 changed files with 12 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Based on robbyrussell's theme, with host and rvm indicators. Example:
|
||||
# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname)
|
||||
|
||||
# @host currentdir rvm:(rubyversion@gemset) node@npm:(nodev@npmv) git:(branchname)
|
||||
# ➜
|
||||
# Get the current ruby version in use with RVM:
|
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
|
||||
|
|
@ -9,14 +9,22 @@ else
|
|||
RUBY_PROMPT_="%{$fg_bold[blue]%}rbenv:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} "
|
||||
fi
|
||||
fi
|
||||
if which node &> /dev/null; then
|
||||
NPM_VERSION_=$(npm -v)
|
||||
if which nvm &> /dev/null; then
|
||||
NODE_PROMPT_="%{$fg_bold[blue]%}nvm:(%{$fg[green]%}\$(nvm current)%{$fg[white]%}@%{$fg[yellow]%}$NPM_VERSION_%{$fg_bold[blue]%})%{$reset_color%} "
|
||||
else
|
||||
NODE_PROMPT_="%{$fg_bold[blue]%}node:(%{$fg[green]%}\$(node -v)%{$fg[white]%}@%{$fg[yellow]%}$NPM_VERSION_%{$fg_bold[blue]%})%{$reset_color%} "
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get the host name (first 4 chars)
|
||||
# Get the host name (first 7 chars)
|
||||
HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,7] at %{$fg_bold[cyan]%}%c "
|
||||
GIT_PROMPT_="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}"
|
||||
# http://stackoverflow.com/questions/3005963/how-can-i-have-a-newline-in-a-string-in-sh
|
||||
STR=$'\n%{$fg_bold[red]%}➜ %{$reset_color%}'
|
||||
LINE_PROMPT="$STR"
|
||||
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT_:$LINE_PROMPT"
|
||||
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$NODE_PROMPT_$GIT_PROMPT_:$LINE_PROMPT"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue