Vim Essential Plugin: tComment

The tComment Vim plugin serves one purpose: to help you toggle comments in your code as quickly as possible. I'll show you how easy it is to use in this quick tip.


Usage

This utility plugin is a cinch to use - mostly because it performs only a single task. To comment a line of code, press ctrl _ ctrl _. Alternatively, if you wish to toggle multiple lines, select them in visual mode, and, again, press the trigger sequence: ctrl _ ctrl _

You can also use the shortcut gcc to comment a single line at a time. If you'd instead prefer to comment a single word, a few letters, or any other motion, use gc{motion}. For example, to comment the first word on a line, I could type: gcw, or, for the first three words: gc3w.

Tags:

Comments

Related Articles