DEV Community

Cover image for (Un)Commenting Multiple Lines

(Un)Commenting Multiple Lines

Musale Martin on June 24, 2020

Commenting multiple lines Move the cursor to the start line of the comment. Press ESC to enter insert mode. Press ctrl+v to enter visua...
Collapse
 
coreyja profile image
Corey Alexander

If you aren't opposed to a plugin, I really like vim-commentary by tpope, for this! Its language aware so it can use the correct comment for the correct language!

github.com/tpope/vim-commentary

With this installed you can do gcc to toggle the comment on a single line, and to do multiple you can select them in visual mode as above, and go gc to either comment or uncomment the lines!