From dbfc703100efb568a21b853aff6dd82332356c0a Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Sat, 8 Sep 2012 15:31:56 +1000 Subject: [PATCH] Add option to change last command status symbol in peepcode theme. --- .../prompt/functions/prompt_peepcode_setup | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/modules/prompt/functions/prompt_peepcode_setup b/modules/prompt/functions/prompt_peepcode_setup index fbb17ee8..b4aee871 100644 --- a/modules/prompt/functions/prompt_peepcode_setup +++ b/modules/prompt/functions/prompt_peepcode_setup @@ -25,6 +25,17 @@ function prompt_peepcode_precmd { fi } +function prompt_peepcode_help { + cat <<'EOH' +This theme's last command status symbol can be customized as follows: + + prompt peepcode + +If this option isn't provided the theme defaults to ☻ . + +EOH +} + function prompt_peepcode_setup { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS @@ -37,6 +48,12 @@ function prompt_peepcode_setup { # Add hook for calling vcs_info before each command. add-zsh-hook precmd prompt_peepcode_precmd + # Customizable parameters. + local command_exit_status='☻ ' + if [[ -n "$1" ]]; then + command_exit_status="$1" + fi + # Set vcs_info parameters. zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' check-for-changes true @@ -51,12 +68,24 @@ function prompt_peepcode_setup { zstyle ':prezto:module:ruby' version ' %F{white}%v%f' # Define prompts. - PROMPT=' + PROMPT=" %~ -%(?.%F{green}☻%f.%F{red}☻%f) ' +%(?.%F{green}${command_exit_status}%f.%F{red}${command_exit_status}%f) " RPROMPT='${ruby_info[version]}${vcs_info_msg_0_}' } +function prompt_peepcode_preview { + if (( ! $#* )); then + prompt_preview_theme peepcode + print + prompt_preview_theme peepcode "❯" + print + prompt_preview_theme peepcode "$" + else + prompt_preview_theme peepcode "$@" + fi +} + prompt_peepcode_setup "$@"