I am trying to automatically switch my keyboard layout from de to us when leaving insert mode in vim. langmap
is not an option, as I sue both us and es keyboard layout system wide.
Could anyone explain why using
function! SetUsLayout()
silent !setxkbmap us,de
endfunction
autocmd InsertLeave * call SetUsLayout()
does not switch from de to us, nor us to de, when leaving insert mode? I already read: How to automatically change keyboard layout on switch to vim normal-mode? But could not find an answer.
First changing completely to us and then to mixed layout does not solve the issue:
function! SetUsLayout()
silent !setxkbmap us
silent !setxkbmap us,de
endfunction
autocmd InsertLeave * call SetUsLayout()
does not work either. In both cases the layout active in insert mode is continued to be used. The function
function! SetUsLayout()
silent !setxkbmap us
endfunction
autocmd InsertLeave * call SetUsLayout()
however, works perfectly fine. Switching to us layout from an initial de layout. This however is not an option, as then switching back to es is no longer possible.