From d581d0e1ff26e6ff61ac50968dc1d358c134bd0a Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Sun, 28 Jul 2013 23:37:08 +0800 Subject: [PATCH 1/2] opt: Optimized the performance. add: Display of line number and shell level. --- themes/ys.zsh-theme | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 6388be552..41529fe5a 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -6,29 +6,34 @@ # http://blog.ysmood.org/2013/03/my-ys-terminal-theme/ # Mar 2013 ys -# Machine name. -function box_name { - [ -f ~/.box-name ] && cat ~/.box-name || hostname -s -} - -# Directory info. -local current_dir='${PWD/#$HOME/~}' - -# Git info. +# Git Info local git_info='$(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}on%{$reset_color%} git:%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x" ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o" -# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $ + +: <<'FORMAT' +Prompt format: + +PRIVILEGES USER@MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM +$ + +For example: + +% ys@ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] - 12 +$ + +FORMAT + PROMPT=" -%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ +%{$terminfo[bold]$fg[blue]%}%#%{$reset_color%} \ %{$fg[cyan]%}%n \ -%{$fg[white]%}at \ -%{$fg[green]%}$(box_name) \ +%{$fg[white]%}@ \ +%{$fg[green]%}%m \ %{$fg[white]%}in \ -%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ +%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${git_info} \ -%{$fg[white]%}[%*] +%{$fg[white]%}[%*] L:%L N:%i %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" From 0617007cecfcb00b6d6ff09459d96ccfcc41bd60 Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Mon, 29 Jul 2013 00:52:43 +0800 Subject: [PATCH 2/2] doc: Fixed a comment mistake. --- themes/ys.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 41529fe5a..78553a511 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -17,12 +17,12 @@ ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o" : <<'FORMAT' Prompt format: -PRIVILEGES USER@MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM -$ +PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM +$ COMMAND For example: -% ys@ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] - 12 +% ys@ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] L:1 N:6 $ FORMAT