浏览代码

fix(vi-mode): fix cursor change on visual mode (#11586)

Fixes #11586
Marc Cornellà 2 年之前
父节点
当前提交
f7d903f3a3
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      plugins/vi-mode/vi-mode.plugin.zsh

+ 7 - 0
plugins/vi-mode/vi-mode.plugin.zsh

@@ -43,6 +43,13 @@ function _vi-mode-set-cursor-shape-for-keymap() {
   printf $'\e[%d q' "${_shape}"
   printf $'\e[%d q' "${_shape}"
 }
 }
 
 
+function _visual-mode {
+  typeset -g VI_KEYMAP=visual
+  _vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP"
+  zle .visual-mode
+}
+zle -N visual-mode _visual-mode
+
 function _vi-mode-should-reset-prompt() {
 function _vi-mode-should-reset-prompt() {
   # If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically
   # If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically
   # check whether we're using the prompt to display vi-mode info
   # check whether we're using the prompt to display vi-mode info