Lots of clean up for loquacious prompt

- Move zle keymap select code to prompt module
- Use vcs_info to get repo information
- Reduce number of functions required to generate prompt
- Set $PS1 once in setup to a bunch of $PS1_* variables. These variables are set
  before each prompt. Doing this lets me change prompt themes more easily.
This commit is contained in:
Eryn Wells 2012-11-29 11:15:24 -08:00
parent 66438f666c
commit d3b8abce8e
2 changed files with 69 additions and 100 deletions

30
zshrc
View file

@ -23,6 +23,10 @@ function {
fpath=($myfpath/makers $myfpath $fpath)
}
print_info_sub_noisy 2 "Loading vcs_info module"
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
print_info_sub_noisy 2 "Configuring prompt: $PROMPT_THEME"
autoload -U promptinit
@ -153,29 +157,3 @@ if [ -e $HOME/.zshrc.local ]; then
print_info_noisy 3 "Sourcing local Z Shell settings"
source $HOME/.zshrc.local
fi
function zle_get_mode {
case "$KEYMAP" in
main|viins)
echo "vi-ins"
;;
vicmd)
echo "vi-cmd"
;;
esac
}
function zle_keymap_select {
local mode=`zle_get_mode`
case "$mode" in
vi-ins)
RPS1="INSERT"
;;
vi-cmd)
RPS1="COMMAND"
;;
esac
zle reset-prompt
}
zle -N zle-keymap-select zle_keymap_select