I want to map kk to CtrlO so I can more easily escape insert mode to issue some key commands (I rather dislike using the backspace and delete keys).
I can issue the following command in a vim session to achieve the desired result
:imap kk <C-O>
But if I put this line in my .vimrc file, pressing kk does nothing (even the ‘kk’ doesn’t get printed).
imap kk <C-O>
what am I doing wrong?
The problem was that I had a space at the end of my line so
kkwas being remapped to<C-O>' 'and the space command doesn’t do anything. Let this be a warning to all: Trailing spaces are evil.I can’t believe no one has pointed this out. There are a whole host of
vi(notvim) key mappings for insert mode I never knew about (I can’t guarantee they all work invim). For exampleCtrlH –> Backspace
CtrlJ –> Return/Enter
CtrlI –> Tab
Here is the full list