To use NERDComToggleComment, I need to type


(in my case, Leader is ,).

I would like to map this to a Ctrl+C (or Ctrl+any key if Ctrl+C is reserved/unavailable for any reason).

What should I write in .vimrc?

I naively tried those two different approaches. None of which gave satisfaction.

" Call existing mapping
vmap <silent><C-c> : <Leader>c<Space>
" Call function directly
vmap <silent><C-c> :NERDComToggleComment<CR>

1 Answer 1


While <C-C> might not be the best key combination, you can use the auxiliary mappings provided by the plugin:

vmap <silent><C-C> <Plug>NERDCommenterToggle

See also :help NERDComMappings.

  • Thanks. It works. I'm not familiar with the <Plug> syntax. I saw that somewhere and thought <Plug> was some sort of placeholder or example. `
    – Jérôme
    Commented Jan 12, 2017 at 14:02
  • :help NERDComMappings returns E149: Sorry, no help for NERDComMappings.
    – Jérôme
    Commented Jan 12, 2017 at 14:02
  • Any reason not to use Ctrl+C? (When I launch a command from vim, Ctrl+C is still usable so stop the command.)
    – Jérôme
    Commented Jan 12, 2017 at 14:05
  • @Jérôme Maybe you didn't set up the help tags properly. Try running :helptags nerdcom/docdir where nerdcom/docdir is the directory that contains NERDCommenter's docs and then try using :help NERDComMappings again.
    – Ingo
    Commented Jan 12, 2017 at 14:09
  • @Jérôme No particular reason, I just try to stay clear of key combinations that are likely to cause issues at some point, though I do not know if any such problem will ever arise...
    – Ingo
    Commented Jan 12, 2017 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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