How to map Ctrl+A and Ctrl+Shift+A differently?

前端 未结 6 510
别那么骄傲
别那么骄傲 2020-12-04 17:20

In a terminal, one cannot distinguish Ctrl+A and Ctrl+Shift+A as they both emit the same key code, so I can see why Vi

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 17:49

    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 / , / / / etc. (Only exception is / .) 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 release.

提交回复
热议问题