Friday, May 3, 2013

Block comment and uncomment codes in VIM

In VIM, it is quite easy to comment/uncomment a block of lines.

To comment a block of lines:
a. Ctrl-V and mark the block of lines to be commented out;
b. shift-I and write the text that you want to prepend to each line, e.g. #
c. press escape.

To uncomment a block of lines:
a. Ctrl-V and go down vertically until the last commented line;
b. press x.

No comments: