Had a discussion recently with Yaroslav on switching to Emacs or vi. And I tried again and I failed. The reason is so stupidly obvious it's hard to explain. You see, I got this:

This is not a cultural thing. I need to switch my keyboard layout, hundreds of times a day. And the Cmd+Space combo is the most worn one on my keyboard, by far.
However, the problem is much deeper. The problem is what I call the text-meta-ui, and it boils down to escaping. Let me explain. A standard OS X app is driven by keyboard shortcuts, usually like so:

The beauty of Cocoa is that all the keyboard shortcuts implemented that way will be interpreted based in the keycode only. That means that independently of current keyboard layout, the commands get interpreted unambigously. Find is Cmd+F and so on. So if I am in a Russian-language file, and I need to find something, I never change my layout to anything - the shortcut for the find dialog works out of the box, the tab key is idempotent in all layouts, same for Enter/Return. No switching.
Now, some apps are buggy in that regard. Carbon apps do not honor the keycode convention until their authors have paid attention - all Adobe apps for OS X had this huge omission which make working with them akin to swimming in glue - it's been enough to switch your layout and bam! all of your shortcuts are dead. TextMate bundles have the same gaping problem - when you are on the different layout, all of your shortcuts fall through to the viewport. Given that Textmate is now a dormant project, I don't expect the problem to be fixed, but who knows.
Now let's look at Aquamacs from this perspective (I am using it as an example). What is the shortcut for "Help"? C-h (Ctrl-and-then-h). Let's call it up.
![]()
So far so good. Now let's switch the layout and try that again.
![]()
Now this is what I call the meta WTF of UNIX editors. Aquamacs recognizes my input based on characters, not keycodes - therefore, when I am in the russian layout any kind of meta-command will involve a kbd switch. And not only that - the real annoyance is when the argument for the meta-command itself is going to be the in Russian as well. Not one, but two keyboard switches (one to go into meta mode, one to return to literal input in meta mode). And unfortunately, in that sequence:
Ctrl-something-(ow-shit-cussword-I-need-to-switch-layout)-Esc-
(cmd+space)-Ctrl-some-
another-(cussword-I-need-an-argument-in-russian)-(cmd+space)-
аргумент-enter
This, for me, is a killer. Four times I've tried to start with the ubergeek editors, and every time it stopped at this very moment.
When you have to switch the keyboard layout. And yes, I know that you can toggle the layout temporarily on OS X - this does not scale.
So a question (for folks still reading this) - how do you handle Emacs/Vi(m) with multiple keyboard layouts (short of remapping the keyboard switch to capslock which does not really solve the problem)? Googling for discussions on that subject did not yield anything meaningful.
What others said
tikhomirov
For Vim I use this settings:
set keymap=russian-jcuken
set iminsert=0
Then I can use CTRL-^ (this is on Linux, I'm not sure about Mac) switch keyboard layout for Insert mode. This is not ideal solution, but it allows you to type russian text and use latin characters in Normal mode without switching between layouts.
julik
That's the problem. There is a shortcut for "go-to-that-another-layout-when-this-key-is-pressed" but I can't keep my fingers spread so wide all the time. To do the same in textmate, in comparison:
(Cmd+F)-аргумент-Enter/Return
But that looks like one of the solutions, thx
http://kents.myopenid.com/
In vim you have two options: use ':help keymap' as already mentioned, or even better ':help langmap' assuming that you have this patch installed http://tinyurl.com/aby5y8. I use both methods and never had any of these issues.
In contrary, TextMate has only partial support for what you've just described. For instance, I don't use Cmd-F command, because I always prefer incremental search which is Ctrl-S in TextMate and to my knowledge is impossible to activate if you have Russian input method active. Not to mention that Cmd-F dialog enforces you to use mouse to select regexp option, which is ugly.
julik
Nope, I can select the regexp option if I enable keyboard access for all controls - then the checkboxen are just like any other Tab'abble field. However, ctrl+s is interesting. Probably I should write to Alan about that, Ctrl+ shortcuts falling out with another input method is kinda sucky.
http://yaroslav.markin.net/
Well, at least TextMate 2 is in progress. This century maybe.