What's a quick way to comment/uncomment lines in Vim? - Stack Overflow
For those tasks I use most of the time block selection.
Put your cursor on the first # character, press CtrlV (or CtrlQ for gVim), and go down until the last commented line and press x, that will delete all the # characters vertically.
For commenting a block of text is almost the same: First, go to the first line you want to comment, press CtrlV, and select until the last line. Second, press I#Esc (then give it a second), and it will insert a # character on all selected lines.
permalink -
-
https://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim