How To Comment Several Lines Quickly Using VIM
If you have to insert comment on several lines do you do manually insert the comment character in every line? Stop. Vim is a really good editor and has a nice feature to accomplish this quickly. Here are the steps:
- Enter visual blocking mode by pressing CTRL V (CTRL key and the lowercase v).
1 .Make your selection using motion keys(jklm, etc).
- Press I(uppercase I) to enter block insert mode.
- Press #, the comment character.
- Press Esc key. The comment character # will be inserted on each line the visual block selection.
Read more about visual blocking mode using the vim help topic visual-block. At the command line(:), type help visual-block.