I have bash set up with Vi keybindings, however when a command finishes running it returns to insert mode rather than movement mode.
I can use bind '"\C-M":vi-movement-mode'
in my .bashrc
to map the enter key to movement mode, but this does not allow the typed command to be run.
I can use
bind '"jj":vi-movement-mode'
bind '"\C-M":"jj\n"'
to exit out of movement mode when the enter key is pressed, but this returns to insert mode when the command is finished.
This is useful because it means I can enter a command, then use 'k' to scroll back through the command history, or use 'p' to paste another command, without having to exit insert mode every time.
How can I set up a single keybinding to run a command and exit out of insert mode?
Likely unnecessary info but I'm running on cygwin with windows terminal (painful but necessary).