Terminal Hackery


Musings on software development


Can Someone :help Me?

Vim has the best documentation ever available for a software product. No other software product that I've ever come across or used has had a better documentation. For my first ever blog post, I thought I would explore Vim's extensive documentation and how to start using it effectively.

Newcomers to Vim don't seem to use it enough but Vim's :help can be incredibly useful. You will be astonished at the amount of documentation Vim comes with. Vim has an infamous learning curve but I believe that :help actually makes Vim surprisingly easy to use.

The most common way to use :help is to ask what a key does in vim. If you use Vim or are new to Vim, you might have seen this image floating around the web:

Vim Cheat Sheet

Using :help

Looking at the above cheat sheet, you might wonder what the g key is for and what "extra cmds" means. Well it means that Vim will wait for you to type the next character after you type in g. What are the different keys you can use with g? This is where :help comes in!

:help g will list all the commands starting with g

And similarily, :help z will list all the commands starting with z. Cool huh? You can use the :help with any key that you want the help for.

And that's only the beginning. What if you wanted to see what :x does? Or what :wall does? Simple. :help :x and :help :wall

Maybe you are wondering what things you can ask help for, and if you can get help on using Vim's help. There is a single most most useful help documentation that explains how to specify a context and reading this help is all that is needed to be proficient in using :help and it is :help help-context.

help-context.txt tells you how you might search for help on commands for different modes and even help on Vim settings! Don't know what set nocp does? Pull out :help 'nocp'. Notice that you can omit the second single quote if you wish.

The great thing about :help is that plugin developers can write their own help docs for their plugins and if you ever need help on a plugin, you can get help on how to use the plugin right inside Vim!

I love perusing the :help when I'm bored, having nothing else to do. It might sound, well, quite boring, but as a Vimmer, you will be astonished at how you keep discovering the next useful thing you can do with Vim! You can never really call yourself proficient in Vim because you keep finding new and interesting commands or tips to use Vim that you didn't know about. This is easily the reason I love Vim so much.

Searching :help Topics

:helpgrep is a powerful command that lets you search for a term inside all of Vim's documentation if you don't quite know what to search for. Vim will load up all the results in its quickfix list that you can browse through by using the :cn and :cN commands to go to the next and the previous match respectively. Of couse, you can read how to use :helpgrep by reading :help :helpgrep

Further Reading

  • :h motion.txt - Different ways of moving around a file, in a single, easy to read help documentation. Read this weekly. Write one or two commands to use in your workflow on a cheat sheet.
  • :h text-objects - A must read. One of Vim's most powerful features.
  • :h ins-completion - Vim's built in insert-mode completion. More powerful than you think.
  • vimtutor - Launch this in a new terminal window. This will teach you the basics of vim.

:Helpful Plugins

  • vim-help - Provides keybindings to make :help easier to navigate.
  • MarkMyWords - Allows bookmarking of Vim's help docs.
comments powered by Disqus