4

I'm trying to re-map tagbar toggling with <C-&> that I get used to when working with IDEs.

But setting

execute "nnoremap <C-&> :TagbarToggle<CR>"

does not have the desirable effect. When pressing 3 keys at once CTRL-SHIFT-7 where SHIFT-7 stands for & it essentially acts as simple pressing & without CTRL.

Is there a way <C-&> to behave differently other than &?

4

According to one of our former mods, the answer is no:

Sending Control with a character from the 2nd column is useless. Control clears the 7th bit, but this is already 0, so Control+# will just send "#".

Notice that & in the second column has binary representation 01 00110, so clearing the 0 doesn't help.

| improve this answer | |
4

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

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. https://groups.google.com/forum/#!topic/vim_dev/Ym6D-kWIsyo

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 release.

| improve this answer | |

Your Answer

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

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