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?


2 Answers 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.


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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.