简体   繁体   中英

(Vim key mapping) Is that possible to map '<' or '>' in Vim?

I want to add such key mapping like:

nmap <C->> <C-W>+
nmap <C-<> <C-W>-

but it seems doesn't work. Is there any problem with the syntax? I'm wondering that the '>' or '<' could be used just like the normal characters.

It has nothing to do with the syntax, but with one of the following:

  1. Terminal may send <C-<> as just < .
  2. If there is a way to get <C-<> from a terminal, vim does not know about it.
  3. If you are in GUI the representation of <C- combos cannot possibly handle <C-<> because the only keys it knows are from <C-@> (ctrl+0x40) to <C-_> (ctrl+0x5F) because only these combos can be possibly translated to the ASCII control characters (ones with 0x00—0x1F codes). < and > both fall out of this range.

And addition: use nnoremap , not nmap . You don't need remapping here.

Due to the way that the keyboard input is handled internally, this unfortunately isn'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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM