Max Yankov
Max Yankov

Reputation: 13297

Can I set vim up to detect non-english input?

I have several languages configured on my machine, but when I work with vim, I only want to use english — because all vim commands as well as code is in english. (And by english, I mean ASCII). However, when I switch to vim from some other programs, I sometimes forget to switch the language, and when vim doesn't react to keyboard, I get confused because I don't understand the reason for it: may be it's just in the wrong mode, or something else. (I'm still new to it and don't yet feel at home). Of course, it's only an annoyance, but it breaks the flow and concentration.

May be, there's a way to configure vim in such a way that it would alert me that it got input in non-ASCII characters?

Upvotes: 1

Views: 334

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172520

Vim just receives the typed keys from the operating system; without an integration into it, the state of the Input Method Engine is unknown to Vim. Also, no global "input hook" is available in Vim, so you'd have to resort to :mapping individual non-ASCII keys to get an alert.

You can try :set imdisable, which turns off IME input completely in Vim, but I can't say how Vim will then behave.


I have the same problem when working on my wife's computer with a German (vs. US-English) keyboard layout. As I closely interact with Vim, eyes glues to the screen to observe the editing effects, mistyped keys are quickly recognized, and any erroneous effects can be simply undone. I'd say, with a little awareness of the problem and a little training, this is no big issue (at least for me).

Upvotes: 1

Related Questions