Beauty of Vim key combinations

2011-01-23
I can't yet say that I prefer Vim for editing text files in all situations. But I can say that I like it enough this far to continue on improving my Vim skills. One of the beautiful aspects of Vim is how keyboard shortcuts can be combined and this article describes some of those combinations.

Lets look at a few actions that can be performed in Vim:

Lets then look at a few movements that can be performed in Vim:

Now consider that every action can be combined with every movement. So for every action, you can use any movement, and perform that action on the content covered by the movement.

A few examples:

Also, every movement can be repeated by prefixing the movement with a number, describing the movement count. Note that some movements make no sense in repeating, like the start and end of the current line (the count will not have any extra effect). A few examples:

Isn’t it beautiful? So even though the chosen keyboard shortcuts, and their combinations, might seem strange in a single case, there is order and thought to how they was constructed. And this is also what makes vim kind of fun to use. You can always find new combinations to enhance your editing, combinations you’ve not thought of before. Constant room for improving your skills.

One Response to “Beauty of Vim key combinations”

  1. Kikoo Lol says:

    I like these two combos:
    xp to switch two words (x = delete current character, p = paste after cursor)
    ddp to switch two lines

Leave a Reply

Twitter: @mikeplate