From 381cb6341bf37f15cff700e22fac781b7e38e599 Mon Sep 17 00:00:00 2001 From: Michel Albert Date: Wed, 12 Dec 2012 17:10:02 +0100 Subject: [PATCH 1/2] Added a custom prompt theme: exhuma --- themes/exhuma.zsh-theme | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 themes/exhuma.zsh-theme diff --git a/themes/exhuma.zsh-theme b/themes/exhuma.zsh-theme new file mode 100644 index 000000000..6e4c8f6c7 --- /dev/null +++ b/themes/exhuma.zsh-theme @@ -0,0 +1,46 @@ +# +# Features +# ======== +# +# * Shows current user-name and host +# * Show the full path of the current working directory +# * Shows the current time +# While this may not be useful all the time, it sure comes in handy if you +# forgot to prefix a command with ``time``. +# * When working on a git repo, shows the current branch name and status +# indicator. +# * Color of some elements changes if you are in a privileged shell. +# * If there are background jobs, the number of jobs is shown in the shell. +# +# +# Theme examples +# ============== +# +# With background jobs +# +# ┌─[16:56:55] michel@BBS-nexus ‹master*› +# └─[1 background job(s)] ~exhuma/work/oh-my-zsh› +# +# +# Without background jobs: +# +# ┌─[16:56:55] michel@BBS-nexus ‹master*› +# └─ ~exhuma/work/oh-my-zsh› +# + +#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" # TODO: Does not seem to work! +local user_host='%{$terminfo[bold]$fg[blue]%}%n%{$reset_color%}@$fg[green]%m$reset_color' +local current_dir='$fg[blue]%~$reset_color' +local git_branch='$(git_prompt_info)%{$reset_color%}' +local current_time='[%*]' +local backround_jobs='%(1j.$terminfo[bold]$fg[yellow][%j background job(s)]$reset_color .)' + +local ucolor="%(!.%{${fg[red]}%}.%{${fg[green]}%})" # Red if running as root, green if non-root + +PROMPT="$ucolor┌─$reset_color${current_time} ${user_host} ${git_branch} +$ucolor└─$reset_color${backround_jobs}${current_dir}$ucolor%(!.#.›) $reset_color" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}" + +# vim: filetype=zsh : From 96a3d9bae43080380ff3497d85fa7a1a224c1c47 Mon Sep 17 00:00:00 2001 From: Michel Albert Date: Fri, 14 Dec 2012 09:46:28 +0100 Subject: [PATCH 2/2] Added missing `%{..%}` escapes. This resolves buggy behaviour with TAB completion. --- themes/exhuma.zsh-theme | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/exhuma.zsh-theme b/themes/exhuma.zsh-theme index 6e4c8f6c7..8f5804957 100644 --- a/themes/exhuma.zsh-theme +++ b/themes/exhuma.zsh-theme @@ -29,16 +29,16 @@ # #local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" # TODO: Does not seem to work! -local user_host='%{$terminfo[bold]$fg[blue]%}%n%{$reset_color%}@$fg[green]%m$reset_color' -local current_dir='$fg[blue]%~$reset_color' +local user_host='%{$terminfo[bold]$fg[blue]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}' +local current_dir='%{$fg[blue]%}%~%{$reset_color%}' local git_branch='$(git_prompt_info)%{$reset_color%}' local current_time='[%*]' -local backround_jobs='%(1j.$terminfo[bold]$fg[yellow][%j background job(s)]$reset_color .)' +local backround_jobs='%(1j.%{$terminfo[bold]$fg[yellow]%}[%j background job(s)]%{$reset_color%} .)' local ucolor="%(!.%{${fg[red]}%}.%{${fg[green]}%})" # Red if running as root, green if non-root -PROMPT="$ucolor┌─$reset_color${current_time} ${user_host} ${git_branch} -$ucolor└─$reset_color${backround_jobs}${current_dir}$ucolor%(!.#.›) $reset_color" +PROMPT="$ucolor┌─%{$reset_color%}${current_time} ${user_host} ${git_branch} ${backround_jobs} +$ucolor└─%{$reset_color%}${current_dir}$ucolor%(!.#.›) %{$reset_color%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}"