From d94006225fb0c59c670f4926c9bb91d52591f9d6 Mon Sep 17 00:00:00 2001 From: Wentao Han Date: Wed, 14 May 2014 13:37:36 +0800 Subject: [PATCH 1/3] Add my own theme file --- themes/hanwentao.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/hanwentao.zsh-theme diff --git a/themes/hanwentao.zsh-theme b/themes/hanwentao.zsh-theme new file mode 100644 index 000000000..fe7f5fe2e --- /dev/null +++ b/themes/hanwentao.zsh-theme @@ -0,0 +1,7 @@ +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" +PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%# %{$reset_color%}' + +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 3087fc8d7dd4de02dcfeddddff63544216a7e4c1 Mon Sep 17 00:00:00 2001 From: Wentao Han Date: Wed, 14 May 2014 14:23:13 +0800 Subject: [PATCH 2/3] Improve my prompt theme * Display username@hostname when ssh * Change git style, using ASCII characters * Combine status code with the prompt character --- themes/hanwentao.zsh-theme | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/themes/hanwentao.zsh-theme b/themes/hanwentao.zsh-theme index fe7f5fe2e..e18420c73 100644 --- a/themes/hanwentao.zsh-theme +++ b/themes/hanwentao.zsh-theme @@ -1,7 +1,15 @@ -local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" -PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%# %{$reset_color%}' +function ssh_username_hostname() { + if [[ -n "$SSH_CONNECTION" ]]; then + echo "%{$fg_bold[green]%}%n@%m " + fi +} -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]%})" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=" " +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}X%{$fg[cyan]%})" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[cyan]%})" + +local current_dir="%{$fg[blue]%}%~ " +local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%}%? )%# " + +PROMPT='$(ssh_username_hostname)${current_dir}$(git_prompt_info)${ret_status}%{$reset_color%}' From d6b6f7a7f6d2651f75b56e313e51bc7708ad65f2 Mon Sep 17 00:00:00 2001 From: Wentao Han Date: Wed, 14 May 2014 18:36:00 +0800 Subject: [PATCH 3/3] Use bold (bright) font --- themes/hanwentao.zsh-theme | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/hanwentao.zsh-theme b/themes/hanwentao.zsh-theme index e18420c73..cf3e210c9 100644 --- a/themes/hanwentao.zsh-theme +++ b/themes/hanwentao.zsh-theme @@ -4,12 +4,12 @@ function ssh_username_hostname() { fi } -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}git:(%{$fg_bold[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX=" " -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}X%{$fg[cyan]%})" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[cyan]%})" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[yellow]%}X%{$fg_bold[cyan]%})" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[cyan]%})" -local current_dir="%{$fg[blue]%}%~ " +local current_dir="%{$fg_bold[blue]%}%~ " local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%}%? )%# " -PROMPT='$(ssh_username_hostname)${current_dir}$(git_prompt_info)${ret_status}%{$reset_color%}' +PROMPT='%s$(ssh_username_hostname)${current_dir}$(git_prompt_info)${ret_status}%{$reset_color%}'