The standard behaviour of <ESC>
zle vi-mode when in visual mode is to do nothing. But I want that the action of pressing <esc>
in vi-mode visual mode switches the keymap to vi-normal mode (vicmd
). As it does in standard vi.
I tried this:
bindkey -M visual '\e' vi-cmd-mode
but it did not work.
This is the vi-mode configuration file that I'm using
how can I achieve the desired behaviour?
in zsh 5.0.8:
nin-deactivate-region() {
REGION_ACTIVE=0
}
zle -N nin-deactivate-region
bindkey -M visual '\e' nin-deactivate-region
from zsh 5.1 you already have a deactivate-region
widget so it would be easier:
bindkey -M visual '\e' deactivate-region