Is it possible to make all text fields in OS X editable with Vi keybindings?

What I'm looking for is a way to use Vi-style keybindings throughout OS X, similar to how invoking:

$ set -io vi

in a Terminal will give Vi-style keybindings when using the shell.

I'm guessing this doesn't exist but it would be awesome if it did!

If it doesn't exist, anyone have an idea on how it could be approached using OS X's Cocoa APIs?


Solution 1:

There is an OSX only way to do this, without using any 3rd party apps. You just have to create a file ~/Library/KeyBindings/DefaultKeyBinding.dict and put what you want in it. See an example.

Since I dont use Vi, I'm not sure what the specific keybindings are, but there is a great page about Customizing the Cocoa Text System that should get you going.

Solution 2:

There are two option:

  • Vi Input Manager which hasn't been updated since 2009.

  • KeyRemap4Macbook which I've used for a number of different options and has a Vi mode. I can't speak for how well the Vi mode works but the other aspect has been great in a few things I use it.