Pivotal Engineering Journal

Technical articles from Pivotal engineers.

All I do is VIM VIM VIM

A subset of useful vim commands for beginners

Posted on by
Categories:   vim   
Edit this post on GitHub.

I love keyboard shortcuts. Naturally, VIM would be my best friend but it was really hard to get into. While pair programming at Pivotal with expert VIMists (is that a word?) I got to learn a few tricks. Below I've gathered a subset of vim commands that have converted me. Think of it as “just enough vim” to get very comfortable.

I assume you understand the difference between insert, visual and normal mode.

Movement

Editing

“Scrolling”

Switching to insert mode

Text manipulation

Commands

As a quick summary for complete beginners to VIM, you can enter commands while in normal mode by type : followed by the command and enter. Here are some basic ones everyone should know.

:w saves the current file. I remember it as “writes” the file.

:q quits the file.

:wq saves the file and quits the file. :x is equivalent. Not sure why it exists but I use it often.

:qa quits all the buffers.

When you're pasting blocks of text from outside of vim, you should run :set paste to prevent vim auto inserting tabs in your text.

Multiple windows

Quickly highlight blocks of texts

Fancy stuff

So there are a few handy moves that I don't know where to put. They are definitely beyond the basics.

Markers

Plugins

There are tons of plugins available for VIM that does very specific things. The one I suggest as a must have is NERDTree.

Conclusion

If you memorize this subset of commands I'm confident you'll begin to navigate VIM with ease…

And when I step into the building everybody's hands go … on the keyboard