vi-mode: remove TRAPWINCH from plugin (#7753)
* Remove TRAPWINCH; it's unrelated to vi-mode
* Update prompt with ad hoc KEYMAP variable
Fixes mode indicator when the terminal window is resized
Diff
1diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
2index c1cdd2851b5fc998eb52f234ec703ba31199f784..a82e414398050a4ef228262e6351920991472403 100644
3--- a/plugins/vi-mode/vi-mode.plugin.zsh
4+++ b/plugins/vi-mode/vi-mode.plugin.zsh
5@@ -1,14 +1,12 @@
6 # Updates editor information when the keymap changes.
7 function zle-keymap-select() {
8+ # update keymap variable for the prompt
9+ VI_KEYMAP=$KEYMAP
10+
11 zle reset-prompt
12 zle -R
13 }
1415-# Ensure that the prompt is redrawn when the terminal size changes.
16-TRAPWINCH() {
17- zle && { zle -R; zle reset-prompt }
18-}
19-
20 zle -N zle-keymap-select
21 zle -N edit-command-line
2223@@ -42,7 +40,7 @@ if [[ "$MODE_INDICATOR" == "" ]]; then
24 fi
2526 function vi_mode_prompt_info() {
27- echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
28+ echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
29 }
3031 # define right prompt, if it wasn't defined by a theme