0

In various editors one can mark a block of code and with a shortcut, comment it right away. Is there a possible way to do it in Vim without an extra plugin? If not, which plugin or script would you suggest?

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
gon1332
  • 113
  • 5

2 Answers2

2

The best way that I found is using tpope's vim-commentary plugin. You're able to use the ctrl+v I# mentioned in the question linked to in the comment to the OP, but this will automatically work with different comment types with different languages.

Cody Poll
  • 723
  • 4
  • 8
0

From my answer over here:

I use scrooloose/nerdcommenter for this.

With this plugin you can visual select your lines and hit leader+c to toggle comments. Depending on the file type it will use different symbols for commenting.

OrangeTux
  • 3,566
  • 3
  • 20
  • 27