开发者

gVim doesn't recognize the Meta (Alt) Key in an imap after changing the encoding

开发者 https://www.devze.com 2022-12-23 06:39 出处:网络
In order to edit html files, I have the follow开发者_如何转开发ing three imaps in a file that I source for filetype html:

In order to edit html files, I have the follow开发者_如何转开发ing three imaps in a file that I source for filetype html:

imap <buffer> <M-[> &uuml;
imap <buffer> <M-;> &ouml;
imap <buffer> <M-'> &auml;

This works fine until I change the encoding of the html file with set enc=utf-8. Now, pressing Alt-[ for example gives me a Û.

Interestingly, after sourcing the same file again, it expands the imaps correctly.

This doesn't really make sense to me. So, why is this and how can I have a more constistent environment regarding imap and utf-8.

This is occuring with gVim 7.1 for Windows.


It sounds like the same problem listed here: https://superuser.com/questions/154491/utf-8-option-makes-alt-key-to-insert-accented-characters-in-vim-how-to-disable-i

I'd suggest putting set encoding = utf-8 in your vimrc above your imap mappings, rather than turning it on for specific files.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号