Advanced Vim Cheat Sheet

General

Plugins

The most helpful part of plugins is that they make vim a better fully featured IDE. Concepts like global search and finding a file to open are solved with plugins. They also can bring out some missing features of vim, like automatic commenting.

Essential Plugins

Awesome Plugins

Regex and Searching

Perl style regexes (Very Magic Mode)

Start a search with \v. Everything else can act like a normal regex search, except you have to escape / and \. If you are searching backwards, you’ll also have to escape ?.

Differences from Perl Regex

The < and > characters are special for start and end of word. Escape them to search for them literally.

Literal Search (Very No Magic Mode)

Start a search with \V. Now you only have to escape / and \. It would be nice if you didn’t have to escape anything, but alas vim is not like this.

Let’s say you have this file

www.yahoo.com
blah some other stuff
www.google.com
www.ebay.org

And you want to change it to

www.chase.com
blah some other stuff
www.chase.com
www.chase.org

What you’re doing is saying find all domain names and change the inner part to chase. You can do this by specifying the part of the search to match. Put \zs before where you want to match and \ze after where you want to match.

So in this case: \v www\. \zs .* \ze \.com

Faster Search and Replace