From 237cfc3c0b54a229d1ae8da2f9e0fbaf783b75ac Mon Sep 17 00:00:00 2001 From: Paul Gideon Dann Date: Tue, 13 Mar 2012 12:26:02 +0000 Subject: [PATCH] Adding port of my personal theme --- themes/giddie/prompt_giddie_setup | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 themes/giddie/prompt_giddie_setup diff --git a/themes/giddie/prompt_giddie_setup b/themes/giddie/prompt_giddie_setup new file mode 100644 index 00000000..809bd335 --- /dev/null +++ b/themes/giddie/prompt_giddie_setup @@ -0,0 +1,59 @@ +# +# A colourful, friendly, multiline theme with some handy features: +# +# * Simple VCS branch, staged, and unstaged indication. +# * Prompt character is different in a VCS repository. +# * Last command exit status is displayed clearly if it was non-zero. +# +# This theme is particularly well-suited to the pastel colours used by KDE's +# Konsole terminal emulator. +# +# Authors: +# Paul Gideon Dann +# + +# TODO: Currently only tailored to git. + +function prompt_giddie_precmd { + vcs_info + + # Replace "/home/" with "~" + prompt_custom_wd=${PWD/$HOME\//\~/} + + # Choose prompt symbol based on whether on not we're in a repository. + { git branch 2>&1 } >/dev/null + if [[ $? == 0 ]]; then + prompt_symbol='±' + else + prompt_symbol=')' + fi + + # This will be displayed additionally if the last exit status was non-zero. + prompt_exit_status="%F{red}%B-> [%?]%b%f" +} + +function prompt_giddie_setup { + autoload -Uz vcs_info + autoload -Uz add-zsh-hook + add-zsh-hook precmd prompt_giddie_precmd + + prompt_opts=(cr percent subst) + + zstyle ':omz:prompt' vicmd '%F{yellow}--- VI-COMMAND ---%f' + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u' + zstyle ':vcs_info:*' actionformats ' on %F{magenta}%b%f%c%u %F{yellow}(%a)%f' + zstyle ':vcs_info:*' stagedstr '%F{green}+%f' + zstyle ':vcs_info:*' unstagedstr '%F{green}!%f' + + PROMPT='%(?..${prompt_exit_status} +)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${prompt_custom_wd}%f${vcs_info_msg_0_} +%F{blue}${prompt_symbol}%f ' + RPROMPT= + SPROMPT='%F{blue}zsh: %F{yellow}correct %F{magenta}%R%f to %F{green}%r%f [nyae]? ' +} + +prompt_giddie_setup "$@" + +# vim: ft=zsh