songyy
songyy

Reputation: 4563

Vim -- Mapping of <c-<> not working?

I want to map c-< to be <c-w> <, so I put these in my .vimrc:

noremap <c-<> <c-w><

And it doesn't work.

:verbose map <c-<> shows:

<C-<>       * <C-W><

Which means the mapping has succeeded.

If I try noremap <c-.> <c-w><, it doesn't work either; but if I try noremap <c-e> <c-w><, it actually works.

I don't understand.. does vim disallow kind of mapping>

Upvotes: 0

Views: 243

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172520

You need to find different keys for your mapping - those won't work.

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