2012-01-31 23:37:51 -05:00
|
|
|
#
|
|
|
|
# A monochrome theme that displays basic information.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Brian Tse <briankftse@gmail.com>
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2011-07-17 20:15:51 -04:00
|
|
|
function +vi-git-status() {
|
2012-08-06 16:52:38 -04:00
|
|
|
# Check for untracked files or updated submodules since vcs_info does not.
|
2011-07-17 20:15:51 -04:00
|
|
|
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
|
|
|
hook_com[unstaged]='%F{red}●%f'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-03-23 14:57:51 -04:00
|
|
|
function prompt_minimal_precmd {
|
2011-07-17 20:15:51 -04:00
|
|
|
vcs_info
|
|
|
|
}
|
|
|
|
|
2012-03-23 14:57:51 -04:00
|
|
|
function prompt_minimal_setup {
|
2011-10-10 22:16:12 -04:00
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
prompt_opts=(cr percent subst)
|
2011-07-17 20:15:51 -04:00
|
|
|
|
2012-08-06 16:52:38 -04:00
|
|
|
# Load required functions.
|
2011-07-17 20:15:51 -04:00
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
|
2012-08-06 16:52:38 -04:00
|
|
|
# Add hook for calling vcs_info before each command.
|
2011-07-17 20:15:51 -04:00
|
|
|
add-zsh-hook precmd prompt_minimal_precmd
|
|
|
|
|
2012-08-06 16:52:38 -04:00
|
|
|
# Set vcs_info parameters.
|
2011-07-17 20:15:51 -04:00
|
|
|
zstyle ':vcs_info:*' enable bzr git hg svn
|
|
|
|
zstyle ':vcs_info:*' check-for-changes true
|
|
|
|
zstyle ':vcs_info:*' stagedstr '%F{green}●%f'
|
|
|
|
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●%f'
|
|
|
|
zstyle ':vcs_info:*' formats ' - [%b%c%u]'
|
|
|
|
zstyle ':vcs_info:*' actionformats " - [%b%c%u|%F{cyan}%a%f]"
|
|
|
|
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b|%F{cyan}%r%f'
|
|
|
|
zstyle ':vcs_info:git*+set-message:*' hooks git-status
|
|
|
|
|
2012-08-06 16:52:38 -04:00
|
|
|
# Define prompts.
|
2011-07-17 20:15:51 -04:00
|
|
|
PROMPT='%2~${vcs_info_msg_0_} » '
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt_minimal_setup "$@"
|
|
|
|
|