I found a command in NERDCommenter like this:
[count]<leader>cc |NERDComComment|
I have installed the plugin. But, I don't know how to make it work. So what's the meaning of that command? How can I make it work?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this community[count]
is optional. If given, the mapping works for count lines (ie. comments out count lines).<Leader>
is usually the backslash key (\
), although this can be remapped (also see What is <Leader>? and How can I find out what <Leader> is set to? And is it possible to remap <Leader>?)cc
is exactly that: two c
's.NERDComComment
has nothing to do with this key mapping, it's the help tag for more information.So, if you want to comment out the current line: use \cc
from normal mode. For the current and next line, use 2\cc
, etc.
You you can select lines with visual mode and then press \cc
to comment out all the selected lines.
The command is used in normal mode by typing first a count, like 10
, followed by the <Leader>
key (default is \
) and finally cc
.
Example; type 10\cc
in normal mode to comment out 10 lines starting at the cursor position. Omit the count to only comment out the current line.
Many people like to remap the <Leader>
key to ,
. More info here: http://usevim.com/2012/07/20/vim101-leader/