Vim Tips

Comment/Uncomment block of code

Comment:

  1. Press esc
  2. Press control + V to enter VISUAL BLOCK mode
  3. Move the cursor to the end of block that you want to comment
  4. Press shift + I to enter INSERT mode
  5. Type any comment (i.e. #), in the first line of block
  6. Press esc to finish.

Uncomment:

  1. Press esc
  2. Press control + V to enter VISUAL BLOCK mode
  3. Move the cursor to select the code you want to delete
  4. Press X
  5. Press esc to finish.