mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-18 20:00:07 +00:00
fix(vi-mode): fix keymap indicator on zle-line-finish (#9620)
* Update VI_KEYMAP on zle-line-finish. Fixes next prompt draw. * Also fix vi-mode prompt redraw in case previous prompt was canceled * Do not redraw fix prompt if VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset * Use a local variable instead of global in function
This commit is contained in:
parent
e5d206c8c8
commit
3f34ce4da4
1 changed files with 4 additions and 0 deletions
|
@ -50,13 +50,17 @@ zle -N zle-keymap-select
|
||||||
# These "echoti" statements were originally set in lib/key-bindings.zsh
|
# These "echoti" statements were originally set in lib/key-bindings.zsh
|
||||||
# Not sure the best way to extend without overriding.
|
# Not sure the best way to extend without overriding.
|
||||||
function zle-line-init() {
|
function zle-line-init() {
|
||||||
|
local prev_vi_keymap
|
||||||
|
prev_vi_keymap="${VI_KEYMAP:-}"
|
||||||
typeset -g VI_KEYMAP=main
|
typeset -g VI_KEYMAP=main
|
||||||
|
[[ "$prev_vi_keymap" != 'main' ]] && [[ "${VI_MODE_RESET_PROMPT_ON_MODE_CHANGE:-}" = true ]] && zle reset-prompt
|
||||||
(( ! ${+terminfo[smkx]} )) || echoti smkx
|
(( ! ${+terminfo[smkx]} )) || echoti smkx
|
||||||
_vi-mode-set-cursor-shape-for-keymap "${VI_KEYMAP}"
|
_vi-mode-set-cursor-shape-for-keymap "${VI_KEYMAP}"
|
||||||
}
|
}
|
||||||
zle -N zle-line-init
|
zle -N zle-line-init
|
||||||
|
|
||||||
function zle-line-finish() {
|
function zle-line-finish() {
|
||||||
|
typeset -g VI_KEYMAP=main
|
||||||
(( ! ${+terminfo[rmkx]} )) || echoti rmkx
|
(( ! ${+terminfo[rmkx]} )) || echoti rmkx
|
||||||
_vi-mode-set-cursor-shape-for-keymap default
|
_vi-mode-set-cursor-shape-for-keymap default
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue