简体   繁体   English

在Vim中的“插入”模式下,将Ctrl +'重新映射到行尾

[英]Remap Ctrl+' to go to end of line in Insert mode in Vim

I'm unable to remap Ctrl + ' to go to the end of the line when in Insert mode. 在插入模式下,我无法重新映射Ctrl + '到行尾。 This line in my vimrc file doesn't work (doesn't seem to do anything at all): 我的vimrc文件中的这一行不起作用(似乎根本不执行任何操作):

inoremap <c-'> <end>

However, if I use other keys instead of the single quote, it works fine. 但是,如果我使用其他键而不是单引号,则可以正常工作。 For example, this works: 例如,这有效:

inoremap <ce> <end>

Do I need to use a different syntax to use the single quote key in a key remapping like this? 我是否需要使用其他语法在这样的键重新映射中使用单引号键?

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. 由于键盘输入是内部处理的方式,因此,即使在GVIM中,今天也很难实现这一点。 Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. 某些键组合(例如Ctrl +非字母组合键)无法映射,并且Ctrl +字母与Ctrl + Shift +字母无法区分。 (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. (除非您的终端为此发送了不同的termcap代码,但大多数情况下不会这样。)在插入或命令行模式下,请尝试键入组合键。 If nothing happens / is inserted, you cannot use that key combination. 如果没有任何反应/未插入,则无法使用该组合键。 This also applies to <Tab> / <CI> , <CR> / <CM> / <Esc> / <C-[> etc. (Only exception is <BS> / <CH> .) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel. 这也适用于<Tab> / <CI><CR> / <CM> / <Esc> / <C-[>等。(只有<BS> / <CH>除外)。这是一个已知的痛点,以及有关vim_dev和#vim IRC通道的各种讨论的主题。

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. 有些人(最重要的是Paul LeoNerd Evans)想解决这个问题(甚至对于支持此功能的终端机中的控制台Vim),并提出了各种建议cp。 http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8 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. 但是到目前为止,还没有补丁或志愿者出现,尽管许多人表示希望在将来的Vim 8主要发行版中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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