Last Updated: February 25, 2016
· underhilllabs

vim: jump to end of line while in Insert Mode


One of the things I miss from emacs is being able to jump to the end of the current line while in insert mode with C-e. So I decided to write a new key mapping to recreate it.


inoremap <C-e> <C-o>$
  • inoremap maps a key combination for insert mode
  • <C-e> is the keybinding I am creating.
  • <C-o> is a command that switches vim to normal mode for one command.
  • $ jumps to the end of the line and we are switched back to insert mode.


This keybinding allows you to instead jump to beginning of a line while in insert mode.

inoremap <C-a> <C-o>0

*Using inoremap instead of imap

These keybindings could also be written using imap instead of inoremap. The difference between the two commands, is that inoremap is non-recursive. So if somewhere in your .vimrc or a plugin C-o is remapped with:

imap <C-o> <esc>O

Then the above remappings of <C-e> (with imap) would be changed also and no longer work. So in general it is best to remap with the nore (non-recursive) versions:
noremap nnoremap inoremap vnoremap

Say Thanks

1 Response
Add your response


Thanks for explanation of using inoremap instead of imap.

over 1 year ago ·
Filed Under