1

I want to change keyboard language via vimscript shortcut. So that i could type in command mode for instance, 'gis', and then the keyboard would become icelandic. (gis=go is). And when I want the us keyboard i could type in command mode: 'gus'. and then the keyboard would become us.

The following command changes keyboard language to "is" when in the terminal:

setxkbmap -layout is

So therefore, I have come up with the following in the vimscript file.

noremap gis :silent "setxkbmap -layout is"<enter>
noremap gus :silent "setxkbmap -layout us"<enter>

But the problem is that it simply doesn't create the desired effect. How do I go about doing this?

1
  • 1
    You might be interested in :help langmap and :help keymap
    – D. Ben Knoble
    Feb 1 at 18:20
3

The proper syntax is

noremap gus :silent !setxkbmap -layout us<enter><C-L>

The exclamation mark introduces an external, shell command and Ctrl-L redraws the screen.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.