Take the 2-minute tour ×

I am using NERD commenter

Let's say that I want to comment out lines from 78 to 172. This is what I do. I calculate the difference. That is 94. put my cursor on line 78 and then I do: 94 , c space

In this way I comment 94 lines starting from line number 78.

I don't like the calculation that I need to do. I was hoping to pass a range something like

78,172 to comment the code from line 78 to 172. Am I missing something.

Looking at the popularity of this plugin, it seems there must be a better way to comment and uncomment.

share|improve this question

3 Answers 3

up vote 8 down vote accepted

I'd do (in visual mode) :78v172G to select and highlight lines 78 to 172, then just ,c<space>.

share|improve this answer

It doesn't appear that NERDCommenter supports ranges, so Alex's answer would be correct, but he has a typo - it should be 78GV172G to select (note - no preceeding :), followed by your comment function ( in my case \cc).

share|improve this answer
I do as you said that the lines are well selected. But how can I use nerdCommenter comment them out. What should I input. Document says [count]<leader>cc |NERDComComment|, but I don't know what does each part mean. –  hakunami Nov 2 at 2:16

Enter Visual mode <ctrl> + V, using your arrow keys, highlight the lines you want then /c<space> (perhaps you have another key binded for commenting).

share|improve this answer

Your Answer


