Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature request: make normal mode agnostic of keyboard layout #2151
I have English and Russian keyboard layouts (with Latin and Cyrillic letters respectively), and kakoune is unusable in normal layout when Russian layout is active. To start typing text on a new line, I have to first switch to English layout, press "o", then switch to Russian layout and only then start typing the text. As you can imagine, this is very annoying.
Vim solves this using
This should also respect my own mappings, so if I configure a new mapping
I'm not married to
Because Kakoune is a terminal application, it only knows about Unicode characters, not about keys: it doesn't know what keyboard layout you're using, what physical key "щ" corresponds to, or what character that key would produce in English layout, so it's not really possible to solve this in a way that Just Works (although perhaps a GUI-based frontend could do this, someday).
As you've probably discovered, it's not possible to use
It might be useful for Kakoune to have an extra map "mode" that is always applied before the actual current mode, to cover this use-case:
Alternatively, a special map option whose keys are locale codes like
...and if Kakoune was started in a known locale, it would Just Work... assuming each locale has exactly one keyboard layout, or at least one popular keyboard layout, and nobody ever mapped anything to non-Latin keys.
I appreciate you desire to make things Just Work, but the assumptions you mentioned... I don't think we can expect them to hold
Vim has two ways to configure
Vim also supports this:
set keymap=russian-jcukenwin set iminsert=0 set imsearch=0
Which means that you can switch layout within Vim only. And when you're in insert mode, you use desired layout, but if you're in normal mode, EN keymap is used. I was struggling with Russian layout too, and this fix works very well
I agree with the suggestion by @Screwtapello to have a special 'langmap' mode, that when activated is always applied over the current actual mode (except insert mode). This would be useful not only for language maps, but also for non-standard keyboard layouts, such as Dvorak.
I'd also like to mention, such 'langmap' feature should keep recorded macros in mind. That way, the macros are still recorded in the editing language (instead of Cyrillic), and stay consistent whether 'langmap' is on or off.
Would Kakoune's design philosophy -- to have a 1-to-1 relationship between scripted editing and interactive editing -- be against this feature?