Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically change keyboard layout on switch to vim normal-mode?

Sometimes I use vim to write non-US text, and when I wanna use any command in normal mode, I need to change layout to US. It's possible to do that automatically?

PS. I can do mapping like this, but in this case command looks like :ц instead :w - not pretty and typo-risk.

Update

I don't want to use keymap option, because I prefer switch languages by CapsLock. I've try to write autocmd for InsertLeave event, but failed...

Update 2

Probably anybody know, why the following not work?

function SetUsLayout()
  !setxkbmap us,ru
endfunction

autocmd InsertLeave * call SetUsLayout()
like image 836
Aleksey Bakin Avatar asked Jun 11 '12 15:06

Aleksey Bakin


People also ask

How do I change my keyboard layout to normal?

On a hardware keyboard, press and hold the Windows logo key , and then press the Spacebar to cycle through your input methods. If you have a touchscreen, you can switch your touch keyboard layout by tapping or clicking the keyboard icon, and then tapping or clicking the keyboard layout you want to switch to.

Is it worth switching keyboard layout?

It made a world of a difference, as it was a lot more lax on my hands and as a bonus, made my WPM go higher. The only bad thing about it is that a majority of people use QWERTY, so when I am not using my personal keyboard, it can be a bother. But it is worth it.


1 Answers

:help langmap

is likely to provide all the info you need.

like image 71
romainl Avatar answered Oct 06 '22 13:10

romainl