开发者

gvim -- problem when imap'ing certain unicode characters

开发者 https://www.devze.com 2023-03-23 23:35 出处:网络
I have a few vim shortcuts to insert Greek and math characters. (for nicer looking comments and Haskell code.) Unfortunately, the \"forall\" character seems to insert ∀þX instead of just ∀. Does th

I have a few vim shortcuts to insert Greek and math characters. (for nicer looking comments and Haskell code.) Unfortunately, the "forall" character seems to insert ∀þX instead of just . Does this behavior happen for you, and is there a workaround?

imap &开发者_JS百科lt;expr> <A-a> "α"
imap <expr> <A-b> "β"
imap <expr> <A-g> "γ"
imap <expr> <A-l> "λ"
imap <expr> <S-A-f> "∀"
imap <expr> <S-A-e> "∃"

You'll have to use gvim in order to use the "Alt" key combinations; you can change the "A" to a "C" and try to use it in vim if desirable. The same error comes up for me.

(It also seems that I can't map both "alt+key" and "shift+alt+key", but I'll worry about that when it becomes a problem.)


It looks like one of the bugs related to «0x80 byte starts an escape sequence» problem: in UTF-8 is \xe2\x88\x80... you see the last byte, do you? If you want to use it you should change mapping to

inoremap <expr> <S-A-f> "\u2200"

Also note the nore: don't use *map unless you know why you prefer it to nore version, it may save you from troubles when your vimrc grows. Another option is

inoremap <S-A-f> ∀
0

精彩评论

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