Skip to content

VIM insert mode shortcuts

A few months back, I stumbled upon a blog post with some interesting VIM shortcuts for within insert mode.

  • Ctrl+t and Ctrl-d adjust the current line indent one level to the right and left, respectively.
  • Ctrl+w deletes the last word. I already use this one a lot because it’s the same as in Readline’s Emacs mode (which I prefer over its vi mode).
  • Ctrl+u deleted all the way to the first non-whitespace character.

But the best stuff was in the comments:

  • Ctrl+o enters normal mode for just one command and then returns to insert mode. I find myself very often going to normal mode ‘temporarily’. This should make these occasions pass quicker.
  • Ctrl+y repeats the character at this position from the line above in this line. Ctrl+e does the same for the line below.
  • Ctrl+x Ctrl+l can be used to copy a whole line, allowing you to cycle through the lines with Ctrl+P and Ctrl+N.

    1 Comment ( Add comment / trackback )

    1. (permalink)
      Comment by halfgaar
      On October 10, 2009 at 12:28

      Why didn’t I know this before? I have even complained about the fact that ctrl-w didn’t work in vim, because I often wanted to delete a word and going back to command mode sucks.

      Now to incorporate this into my routine.

    Post a comment

    (required)
    (required)

    Your email is never published nor shared.

    (optional)
    Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>