From 4bc2ee22bf773d545c1b277b7c2141f1d5642428 Mon Sep 17 00:00:00 2001 From: Nadav Shatz Date: Mon, 3 Mar 2014 11:07:59 -0500 Subject: [PATCH] Added a new theme called smiley, it supports git, python virtual env and last command exit state display. --- modules/prompt/functions/prompt_smiley_setup | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 modules/prompt/functions/prompt_smiley_setup diff --git a/modules/prompt/functions/prompt_smiley_setup b/modules/prompt/functions/prompt_smiley_setup new file mode 100644 index 00000000..e4c1c723 --- /dev/null +++ b/modules/prompt/functions/prompt_smiley_setup @@ -0,0 +1,57 @@ +# +# A simple theme that displays: +# python virtual env +# git branch +# git state +# last command exit state (smiley/X) +# +# Authors: +# Nadav Shatz +# +# Screenshots: +# http://i.imgur.com/ijycV6n.png +# + +# Load dependencies. +pmodload 'helper' + +function prompt_smiley_precmd { + unsetopt XTRACE KSH_ARRAYS + + # Get Git repository information. + if (( $+functions[git-info] )); then + git-info + fi + + if (( $+functions[python-info] )); then + python-info + fi +} + +function prompt_smiley_setup { + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(percent subst) + + # Add hook for calling git-info before each command. + add-zsh-hook precmd prompt_smiley_precmd + + # Set editor-info parameters. + zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' + + # Set python-info parameters. + zstyle ':prezto:module:python:info:virtualenv' format '%F{yellow}[%v]%f ' + + # Set git-info parameters. + zstyle ':prezto:module:git:info' verbose 'yes' + zstyle ':prezto:module:git:info:branch' format '%F{blue}%b%f' + zstyle ':prezto:module:git:info:dirty' format '%%B%F{red} ±%f%%b' + zstyle ':prezto:module:git:info:keys' format \ + 'prompt' '(%b%D)' + + # Define prompts. + PROMPT='$python_info[virtualenv]${git_info[prompt]} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) ' + RPROMPT='${editor_info[overwrite]}${VIM:+" %B%F{green}V%f%b"}' + SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' +} + +prompt_smiley_setup "$@"