Learn Vim at your own pace with my self-study Core Vim Course.

Learn more

Learn Vim at your own pace with my self-study Core Vim Course.

Google vimdocs with a custom search engine

Here’s a quick tip: if you can’t find what you’re looking for in Vim’s built-in documentation, use a search engine instead. All of Vim’s documentation is online at vimdoc.sourceforge.net, so it’s indexed by Google & Co. If you create a custom search engine for your browser, then you can easily limit your searches to only return results from vimdoc.sourceforge.net.

You can add a custom search engine in Chrome by right-clicking on the address bar (or holding the ctrl key while clicking it), then selecting the “Edit Search engines…” item from the contextual menu. That opens up a settings tab where you can edit your custom search engines:

Custom search engines in Google Chrome

I’ve created a Vimdocs search engine with the following values:

name: Vimdocs
keyword: v
URL: http://www.google.com/search?q=%s+site:http://vimdoc.sourceforge.net

The %s item in the URL is a placeholder that will be replaced with whatever text I enter when I use this custom search engine.

Suppose that I want to find the documentation on search offsets. I press cmd-L to focus the address bar, then I type v followed by a space. The address bar brings up a prompt to indicate that I’m using the custom Vimdocs search engine:

The address bar shows a Vimdocs prompt

After typing my query, I hit enter and it shows the search engine results page:

Google says: 'did you mean "search offset"?'

Note that I mis-spelled search and offset, but Google guessed what I wanted and served the results for my corrected query. Search engines are more liberal in what they accept than Vim’s built-in :help and :helpgrep commands.

This trick is especially useful if you don’t know the helptag for the item that you want to know more about. If you can come up with a query that contains enough words to identify the right page of the documentation, then you can usually find what you’re looking for.

Comments


Level-up your Vim

Training

Boost your productivity with a Vim training class. Join a public class, or book a private session for your team.

Drew hosted a private Vim session for the shopify team that was one of the best workshops I have ever attended.

John Duff, Director of Engineering at Shopify

Publications

Make yourself a faster and more efficient developer with the help of these publications, including Practical Vim (Pragmatic Bookshelf 2012), which has over 50 five-star reviews on Amazon.

After reading it, I've switched to vim as my default editor on a daily basis with no regrets. ★★★★★

Javier Collado

Learn to use Vim efficiently in your Ruby projects

In association with thoughtbot, one of the most well respected Rails consultancies in the world, I've produced a series of screencasts on how to make navigating your Ruby projects with Vim ultra-efficient. Along the way, you’ll also learn how to make Ruby blocks a first-class text object in Vim. This lets you edit Ruby code at a higher level of abstraction. Available to buy from thoughtbot..