I have this map in my .vimrc:
inoremap <C-space> <C-o>l
So that, eg, if I'm in insert mode:
I can just type <C-space>
to move out of parens:
It all works great in the middle of a line. But if that )
were the last character on the line, then the cursor won't move when I hit <C-space>
. Which makes sense, because there is nowhere for it move to.
But what I want in this case is for <C-space>
to behave as if I'd typed <esc>$a
-- ie, gone to the end of the line in normal mode and pressed a
to start appending characters.
How can I update my mapping to achieve this special behavior for the end of line case?
<right>
?<C-O>a
.