I'm new to fish shell and vim custom keybindings. I've put fish in vi-mode and I've noticed some commands were missing such as Ctrl-o in insert mode to execute a normal command. Does anyone know how to add this keybinding ?
I've successfully added the equivalent of:
inoremap jk <ESC>
with:
bind -M insert jk 'set fish_bind_mode default; commandline -f repaint'
But I have no idea how to wait for a command and go back to insert mode afterwards. Thanks in advance.
First of all:
bind -M insert jk 'set fish_bind_mode default; commandline -f repaint'
Could also just be
bind -M insert -m default jk 'commandline -f repaint'
("-m" is short for "--sets-mode", I'm not sure why this doesn't repaint on its own)
Running one command in normal mode is tricky. Because you have to run code after one binding is executed, so you'll have to touch all the bindings.
One possibility is to create a new "default-one" mode, via
bind -M insert -m default-one \co 'commandline -f repaint'
and then you'll have to duplicate all bindings for "default" mode (see them via bind -M default
) to add a -m insert
. I'm not sure what to do with those things that already switch to a different mode like "v" (which switches to visual mode).