From 954e32dea8d7bf019a378aa337fd6176d9d6376e Mon Sep 17 00:00:00 2001 From: Kushina Date: Fri, 17 Jun 2016 11:25:37 +0500 Subject: [PATCH 1/3] my style file --- themes/kushina.zsh-theme | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 themes/kushina.zsh-theme diff --git a/themes/kushina.zsh-theme b/themes/kushina.zsh-theme new file mode 100755 index 000000000..970cee1d3 --- /dev/null +++ b/themes/kushina.zsh-theme @@ -0,0 +1,24 @@ +# Based on robbyrussell's theme, with host and rvm indicators. Example: +# @host ➜ currentdir rvm:(rubyversion@gemset) 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%} " +else + if which rbenv &> /dev/null; then + RUBY_PROMPT_="%{$fg_bold[blue]%}rbenv:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} " + fi +fi + +# Get the host name (first 4 chars) +HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,8] 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" + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 33100af0be74600784470e589bd0274e63b08135 Mon Sep 17 00:00:00 2001 From: Kushina Date: Fri, 17 Jun 2016 11:29:25 +0500 Subject: [PATCH 2/3] Name corrected --- themes/kushina.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/kushina.zsh-theme b/themes/kushina.zsh-theme index 970cee1d3..fe1b5dd35 100755 --- a/themes/kushina.zsh-theme +++ b/themes/kushina.zsh-theme @@ -11,7 +11,7 @@ else fi # Get the host name (first 4 chars) -HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,8] at %{$fg_bold[cyan]%}%c " +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%}' From 44e9e2b20a9476cd8d55445568fbdb3a0e079c66 Mon Sep 17 00:00:00 2001 From: Kushina Date: Fri, 17 Jun 2016 21:00:38 +0500 Subject: [PATCH 3/3] added node version show --- themes/kushina.zsh-theme | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/themes/kushina.zsh-theme b/themes/kushina.zsh-theme index fe1b5dd35..5cb7e9bf1 100755 --- a/themes/kushina.zsh-theme +++ b/themes/kushina.zsh-theme @@ -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%}"