1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prezto/modules/prompt/functions/prompt_santiycr_setup

61 lines
2.0 KiB

12 years ago
#
# A clean but informative theme based on Sorin Ionescu's
#
# Authors:
# Santiago Suarez Ordoñez <santiycr@gmail.com>
#
# Screenshots:
# http://i.imgur.com/4ArSAKB.png
# http://i.imgur.com/5Fxg2z8.png
#
12 years ago
# 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]} '
12 years ago
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 "$@"