How to switch comfortably to vi command mode on the zsh command line?
In vi, I have mapped 'jj' to escape to be able to switch to command mode without using the annoying escape key. Now I want to have the same for command line editing for which I use vi-mode. I already have found the following solution:
bindkey '^j' vi-cmd-mode
lets you change with control-j into command mode. Still searching for a solution without modifier-keys as 'jj' or something similar.
Solution 1:
Note: You should look at man zshzle
for a lot of goodies about customizing bindkey
and emulating GNU readline
.
This is how I mapped jj
to Esc
:
bindkey -M viins 'jj' vi-cmd-mode
If you're interested in distinguishing between insert-mode and normal-mode, you could try out the suggestion akira mentions here