I am trying to map the NERDCommenterToggle command from the nerdcommenter plugin. I want to use "Ctrl+/" for this:

vmap <C-/> <plug>NERDCommenterToggle
nmap <C-/> <plug>NERDCommenterToggle

This won't work, I guess there should be some other name to map the slash key... I've already tried to find some info with :help, but I couldn't find anything.

  • 1
    Mapping / is possible (although not really recommended) but mapping <c-/> is probably not possible in terminal version of vim (unlike the gui one). This is a common problem of key codes (I tried to list some in this post) so it is very likely that you can only have this mapping working in GUI version of Vim (or neovim).
    – statox
    Jul 7 '20 at 12:05
  • I am currently using neovim, how can it be done here?
    – Saavestro
    Jul 7 '20 at 12:09
  • In this regard the behavior is the same between vim and neovim.
    – statox
    Jul 7 '20 at 12:11
  • 2
    It depends on the gui. It should be possible in gvim and xterm with modifyOtherKeys. Don't think Neovim supports this Jul 7 '20 at 12:26
  • Can confirm that you can map <c-/> in Vim in the GUI (at least if it's GTK2), and in a terminal where modifyOtherKeys is supported and enabled (xterm and maybe iterm).
    – user938271
    Jul 7 '20 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.