vi-mode: Allow an insert mode indicator to be set.

Set INS_MODE_INDICATOR to set what will be shown in the prompt during
insert mode.
This commit is contained in:
Alexandra Spillane 2014-06-17 08:16:09 +10:00
commit 748557076d

View file

@ -26,13 +26,19 @@ bindkey -v
autoload -Uz edit-command-line
bindkey -M vicmd 'v' edit-command-line
# if mode indicator wasn't setup by theme, define default
# if command mode indicator wasn't setup by theme, define default
if [[ "$MODE_INDICATOR" == "" ]]; then
MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
fi
# if insert mode indicator wasn't setup by theme, define an empty default
# to preserve existing behaviour
if [[ "$INS_MODE_INDICATOR" == "" ]]; then
INS_MODE_INDICATOR=""
fi
function vi_mode_prompt_info() {
echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/$INS_MODE_INDICATOR}"
}
# define right prompt, if it wasn't defined by a theme