prezto/modules/prompt/functions/prompt_santiycr_setup
Santiago Suarez Ordoñez 355787c3ee santiycr's theme
2013-05-04 17:21:04 -07:00

56 lines
1.9 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# A clean but informative theme based on Sorin Ionescu's
#
# Authors:
# Santiago Suarez Ordoñez <santiycr@gmail.com>
#
# 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 "$@"