Vi Input Manager を会社の iMac にインストールした
ViInputManager 付属の Readme より
Installation
- Move the directory "ViInputManager" into the directory ~/Library/InputManagers/ (Create that directory if it's not already there.)
- Put the file DefaultKeyBinding.dict into the directory ~/Library/KeyBindings/ (Create that directory if it's not already there.) If you already have a DefaultKeyBinding.dict file, edit it to include a binding for VI_escapeMode.See the DefaultKeyBinding.dict included with the package for more information, and the informative article by Jacob Rus about key bindings in Cocoa.
ViInputManager 付属の DefaultKeyBinding.dict
/* Either add these to ~/Library/KeyBindings/DefaultKeyBinding.dict or make this that file. */ { /* Vi Input Manager */ /*** this first one will match conventional Vi by mapping the escape key ** However, on the Mac, I found it to be confusing since Esc is used in other situations * "?U001B" = "VI_escapeMode:"; */ /** So, I recommend using the back-apostrophe (just underneath the escape on most us keyboards) * to turn on the Vi command mode. And then I remapped the original key to require the control modifier */ "`" = "VI_escapeMode:"; "^`" = ("insertText:", "`"); }
オイラの DefaultKeyBinding.dict
/* Picked up from Help search on Key Bindings. Good stuff -shane */ /* ~/Library/KeyBindings/DefaultKeyBinding.dict */ { /* Control key combination */ "^i"="insertTab:"; "^m"="insertNewline:"; /* Option key combination */ "~f"="moveWordForward:"; "~b"="moveWordBackward:"; "~<"="moveToBeginningOfDocument:"; "~>"="moveToEndOfDocument:"; "~v"="pageUp:"; "~d"="deleteWordForward:"; "~^h"="deleteWordBackward:"; "~?010"="deleteWordBackward:"; /* Alt-backspace */ "~?177"="deleteWordBackward:"; /* Alt-delete */ /* Escape should really be complete. */ "?033"="complete:"; /* Escape */ /* Vi Input Manager */ /*** this first one will match conventional Vi by mapping the escape key ** However, on the Mac, I found it to be confusing since Esc is used in other situations * "?U001B" = "VI_escapeMode:"; */ /** So, I recommend using the back-apostrophe (just underneath the escape on most us keyboards) * to turn on the Vi command mode. And then I remapped the original key to require the control modifier */ "^[" = "VI_escapeMode:"; /* "`" = "VI_escapeMode:"; */ /* "^`" = ("insertText:", "`"); */ }
Ctrl-[ で コマンドモードへ移行して、文字入力するときは、i か a で入力モードに移行する.
これで Cocoa なアプリで、Vi-Like なキーバインドが使える様になった.すげぇー!!!イカス.