Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gvim -- problem when imap'ing certain unicode characters

Tags:

vim

unicode

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 <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.)

like image 854
gatoatigrado Avatar asked Jul 15 '26 07:07

gatoatigrado


1 Answers

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> ∀
like image 200
ZyX Avatar answered Jul 17 '26 22:07

ZyX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!