8d7ce18e121b4fd2768906840cd5d38e5ecc148c

Author
Roman Perepelitsa <roman.perepelitsa@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

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 }
14 
15-# 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
22 
23@@ -42,7 +40,7 @@ if [[ "$MODE_INDICATOR" == "" ]]; then
24 fi
25 
26 function vi_mode_prompt_info() {
27-  echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
28+  echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
29 }
30 
31 # define right prompt, if it wasn't defined by a theme