I am aware how to set ZSH's default line editor to use vi-like keybindings…
bindkeys -v
…and even to default each new prompt to be in command mode instead of insert mod by default…
zle-line-init() { zle -K vicmd; }
zle -N zle-line-init
…and most of the time I prefer this behavior. However, it makes a few things very awkward. For example pasting multi-line commands into a terminal for immediate execution becomes nearly impossible.
How can I configure it so that the mode is persistent? I would like whatever mode it was when I executed one line should be the default mode for the next line.
Best Answer
Maybe like:
Or even simpler: