Commenting/uncommenting with vim/gVim

Comment a block:

  • go to first line of block
  • Ctrl+V (or Ctrl+Q) to enter BLOCK mode
  • go to last line of block
  • press Shift+I to enter INSERT mode
  • enter comment string, e.g., # and press ESC

Uncomment a block:

  • go to first line of block
  • Ctrl+V (or Ctrl+Q) to enter BLOCK mode
  • go to last line/char of block
  • press x to remove block

Taken from here:

https://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim/1676690#1676690