diff --git a/modules/prompt/functions/prompt_santiycr_setup b/modules/prompt/functions/prompt_santiycr_setup new file mode 100644 index 00000000..1925155b --- /dev/null +++ b/modules/prompt/functions/prompt_santiycr_setup @@ -0,0 +1,56 @@ +# +# A clean but informative theme based on Sorin Ionescu's +# +# Authors: +# Santiago Suarez Ordoñez +# + +# Load dependencies. +pmodload 'helper' + +function prompt_santiycr_precmd { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + + # Get Git repository information. + if (( $+functions[git-info] )); then + git-info + fi +} + +function prompt_santiycr_setup { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) + + # Load required functions. + autoload -Uz add-zsh-hook + + # Add hook for calling git-info before each command. + add-zsh-hook precmd prompt_santiycr_precmd + + zstyle ':prezto:module:editor:info:completing' format '%F{red}...%f' + zstyle ':prezto:module:editor:info:keymap:primary' format '%F{red}❯%F{yellow}❯%F{green}❯%f' + zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '%F{red}♺%f' + zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{green}❮%F{yellow}❮%F{red}❮%f' + zstyle ':prezto:module:git:info:action' format ':%F{yellow}%s%f' + zstyle ':prezto:module:git:info:branch' format ':%F{green}%b%f' + zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f' + zstyle ':prezto:module:git:info:position' format ':%F{red}%p%f' + zstyle ':prezto:module:git:info:dirty' format '%F{red}✗%f' + zstyle ':prezto:module:git:info:clean' format '%F{green}✔%f' + zstyle ':prezto:module:git:info:keys' format \ + 'prompt' '%F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ + 'rprompt' '%C%D' + + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] || [ -n "$SSH_CONNECTION" ]; then + HOS=" %F{magenta}☁ %f (%F{yellow}%m%f)" + else + HOS="" + fi + PROMPT='%F{cyan}%n%f %2~$HOS ${git_info:+${(e)git_info[prompt]}} ${editor_info[keymap]} ' + RPROMPT='${git_info[rprompt]}%f ${VIM:+" %F{green}V%f"} %F{blue}[%*]%f' + SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' +} + +prompt_santiycr_setup "$@"