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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s