Vim 在尝试修复 Alt 键时插入奇怪的字符 [英] Vim insert strange characters when trying to fix Alt key
问题描述
我在此 主题.编辑完 vimrc
文件后,我的 Vim 现在将 Alt-j 识别为 ê
(这是一个非英文的字符),我该如何解决?
I found the workaround for mapping Alt key on gnome-terminal in this topic. After editing the vimrc
file, my Vim now recognizes Alt-j as ê
(which is a non-english character), how can I fix it?
谢谢
推荐答案
如参考主题中所述,对于 Vim,Alt + character 组合用 ASCII 字符表示设置第 8 位,与某些特殊字符(例如 ê
)相同.只要您不需要输入这些字符(例如因为您是用法语写的 :-),您就可以忽略这种好奇心;只需使用 <A-j>
或文字 ê
表示法编写映射(但在任何 :set encoding=...
之后您的 .vimrc,因为这会影响它们的解释方式).
As explained in the referenced topic, for Vim, Alt + character combinations are represented by ASCII characters with the 8th bit set, which is identical to certain special characters (such as ê
). As long as you don't need to type those characters (e.g. because you write in French :-), you can ignore this curiosity; just write your mapping with either <A-j>
or the literal ê
notation (but after any :set encoding=...
in your .vimrc, because that affects how these are interpreted).
这篇关于Vim 在尝试修复 Alt 键时插入奇怪的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!