This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/modules/prompt/functions/prompt_minimal_setup

51 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

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>
#
2012-08-06 16:53:03 -04:00
# Screenshots:
# http://i.imgur.com/zLZNK.png
#
2012-01-31 23:37:51 -05:00
2014-10-14 19:32:48 -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.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
hook_com[unstaged]='%F{red}●%f'
fi
}
function prompt_minimal_precmd {
vcs_info
}
function prompt_minimal_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
2012-08-06 16:52:38 -04:00
# Load required functions.
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.
add-zsh-hook precmd prompt_minimal_precmd
2012-08-06 16:52:38 -04:00
# Set vcs_info parameters.
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'
2014-10-14 19:32:48 -04:00
zstyle ':vcs_info:git*+set-message:*' hooks git_status
2012-08-06 16:52:38 -04:00
# Define prompts.
PROMPT='%2~${vcs_info_msg_0_} » '
2012-09-10 13:23:34 -04:00
RPROMPT=''
}
prompt_minimal_setup "$@"