From 748557076d657f20bf17acc8ce04a0b91d09e7e7 Mon Sep 17 00:00:00 2001 From: Alexandra Spillane Date: Tue, 17 Jun 2014 08:16:09 +1000 Subject: [PATCH] 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. --- plugins/vi-mode/vi-mode.plugin.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 3ed32b3fb..4220a3d01 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -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