Some Useful vim Commands – My vim Cheatsheet

Posted by Artem Russakovskii on April 9th, 2008 in Linux, My Favorites, Programming

Updated: April 23rd, 2008

[WORK IN PROGRESS] Here is a list of commands that I use every day with vim, in no particular order. Out of a billion possible key combinations, I found these to be irreplaceable and simple enough to remember.



    search for the word under cursor (to the end of the file)


    search for the word under cursor (to the top of the file)


    suggest (p)revious or (n)ext autocomplete from the list of existing keywords in the file or included files (!).

    :go NNN

    go to byte NNN


    redo last command


    search document for SEARCH TERM


    replace FOO with BAR (g)lobally, case (i)insensitively, and asking for (c)onfirmation

    n (N)

    next (previous) search result


    find and jump to a matching brace or parenthesis





    r CHAR

    replace character under curson with CHAR


    start editing before current character


    start editing in the beginning of current line


    start editing after current character


    start editing at the end of current line


    start editing on the next line


    start editing on the previous line

    :wq or ZZ

    write file and exit


    visual block select (rectangular)


    visual line select

    ctrl(or shift)-v y or d

    copy or delete selected text


    yank (copy) current line

    yNNN arrow up/down

    yank NNN lines above or below


    paste the yanked buffer


    change word (delete word under cursor and go into edit mode)


    change N words


    reload the file (revert)

● ● ●

Artem Russakovskii is a San Francisco programmer, blogger, and future millionaire (that last part is in the works). Follow Artem on Twitter (@ArtemR) or subscribe to the RSS feed.

In the meantime, if you found this article useful, feel free to buy me a cup of coffee below.

  • Ikai Lan

    Nice sheet, I wrote a few of these down for myself. You're missing some good ones though:

    When in visual select mode:

    x to "cut" instead of Yank
    > to "tab" the visual block
    < to "untab" the visual block

    D to delete characters on the line after the cursor
    dd to delete the line
    (N)dd to delete N number of lines (10dd to delete 10 lines)
    G to end of file
    :q! exit without saving

  • http://beerpla.net Artem Russakovskii

    Thanks, Ikai. Yeah, this sheet is a work in progress, it's definitely not finished. I'm using this post as a scratchpad and will be adding more useful commands as time permits.

  • http://www.Blashing.com Blasher

    very cool !!!
    I didn't realize anyone used VI any more except those of us developing Unix code.
    Good Stuff !!!!

  • http://beerpla.net Artem Russakovskii

    Oh yeah, most definitely. I love vim, and it gets more and more natural and easy to use every day.