3

I'm fairly fluent with VIM, but find myself having to use GUI programs (in OS X) and their awkward editing modes more and more frequently for my work. I know that OS X lets you use basic emacs keybindings in most textfields (browser window/bar, etc.). I'm wondering if it's possible to switch the emacs keybindings to vim keybindings for those GUI-level input areas.

I understand that it might be possible to do that key-by-key in the keyboard layout preference pane. But that approach seems limited, cumbersome, and not very elegant. I'm thinking--and I may well be wrong here--that since OS X already ships with VIM installed, there should be a way to change a preference file deep in the system that maps VIM instead of emacs keybindings to the GUI text/input areas.

Does anyone know if this is

a) theoretically possible, or if there's something about how OS X maps emacs keybindings to its GUI interface that would make this impossible; and

b) how/where that could be done?

1
  • To clarify the second paragraph: Apple's developer documentation (developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/…) shows that there may be a way of doing this through a standard or custom keybindings.dict file (though I don't know how switching between insert and command modes could be accomplished). That approach seems cumbersome, esp. given the large number of VIM commands; I'm hoping to find a single-line configuration file tweak (from 'emacs' to 'vim' or something like that) to accomplish this. Jun 28, 2013 at 20:07

2 Answers 2

2

KeyRemap4MacBook has a few vi modes that can be toggled on and off and work in any app. When last I used it, it had a pretty extensive list of config options (allowing you to remap keys and the trackpad to do a lot of things besides vi mode), but you can type vi in its search bar to narrow it down.

1
  • This works very, very well. It takes some fiddling to get certain VIM commands to work (e.g., '(' and ')' to jump sentences), but otherwise it works nicely out of the box. Thanks for the suggestion ... probably the next best thing to doing this natively! Jul 1, 2013 at 14:58
0

There used to be a "vi input manager". The original page appears to be down for good but this is how it looked some times ago.

I don't think you'll be able to access the forums or even download the zip but it may put you on the right track, at least.

As an alternative, you could try QuickCursor which lets you edit text directly in MacVim or any other editor.

1
  • Thanks, that's helpful. The program seems to have some issues with the new OS X sandboxing environments, but I'll take a look. Ultimately, I'm hoping to find a native solution for the VIM bindings, much like the emacs bindings native to cocoa input fields. Jun 28, 2013 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .