COMMENT/UNCOMMENT OUT MULTIPLE LINES IN VI/VIM EDITOR

Usually commenting multiple lines using keyboard shortcut is forgotten always when we need it . Hit like if you are one of them who know how to do comment multiple lines but you forget at the moment;)

COMMENT:

Press CTRL + V to go to visual mode

Now your visual block is enable like this on bottom

Press down arrow key to select the lines which you need to comment

Press shift + i to insert

Press shift + # to apply the comment on starting line

Press ESC to comment multiple lines which you selected

UNCOMMENT:

  • CTRL + V
  • PRESS DOWN ARROW TO SELECT THE LINES TO UNCOMMENT
  • PRESS x

Leave a Reply