Vivek
Vivek

Reputation: 700

Setting CTRL + / for comment and uncomment in vim

I am new to Vim. Just started using it. There is one which seems to be missing in vim which is the easy of commenting and uncommenting code. Could anyone tell me how to map the Ctrl + / keys to comment and uncomment code in Vim. I am using NERDCommenter but I am not sure how I could map the commenting commands to CTRL + /

I want to use the same keys for single line and multi line comment.

Upvotes: 0

Views: 953

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172648

Due to the way that the keyboard input is handled internally, various key combinations, especially with Ctrl, unfortunately aren't possible today, even in GVIM. This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

With NERD_commenter, either use the default mappings that start with <Leader>c (where <Leader> is \ by default), or remap as described by :help NERDComMappings.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.

Upvotes: 1

Related Questions