lyokha / vim-xkbswitch

vim plugin for automatic keyboard layout switching in insert mode
MIT License
481 stars 23 forks source link

Mapping for Alt-o? #22

Closed artur-shaik closed 9 years ago

artur-shaik commented 9 years ago

I realized that this commands doesn't work in russian layout.

When I press Alt-o or Alt-O in english it gives me new line and stay in insert mode, but in russian layout this doesn't happen.

Shouldn't it be mapped automatically?

lyokha commented 9 years ago

A good point.

In standard terminals Alt key (aka Meta key) will send <Esc> code, you can check it by setting Insert mode mapping

:imap <Esc>щ <C-o>o

(щ is o in Winkey layout). With this map your issue will be fixed, but unfortunately it breaks more than it fixes: you will experience longer transmission from Insert to Normal mode and worse, you will get unexpected behaviour after leaving Insert mode and pressing o (hmm, happily not in this case but in general).

Actually Alt in Insert mode is internally just a synonym of <C-o> so you can use <C-o>o and <C-o>O to reach what you wanted: this surely will work for you. Not a good alternative but i do not know how to avoid internal usage of Alt inside vim.

Perhaps someone has a good advice for this?

artur-shaik commented 9 years ago

Ok, I see. Thank you for advices.