Commentary plugin for Vim

One of the most frequent operations I do in source code is to add, remove or toggle comments over blocks of code. I used to use the TComment plugin for Vim to do this.

Recently, I discovered Tim Pope’s Commentary plugin that does the same. I have switched to it since its code is smaller and simpler. The only operation I use is to visually mark the lines and gc to toggle commenting on it.

Tried with: Vim 7.4 and Ubuntu 14.04

TComment plugin for Vim

The TComment plugin is a must-have for every Vim user. It does just one thing and does it well: comment or uncomment lines of code in any language.

First clone the plugin from its github homepage and install it using Pathogen.

To comment or uncomment a few lines of code, mark the lines in visual mode. You can do this by pressing Shift-V on the first line and then moving down by pressing j. After that, press gc to comment or uncomment those lines. That is it! 🙂

Tried with: Vim 7.3 and Ubuntu 12.04 LTS