Developers Corner

Problem:

Answer:

The following is the contents of a file that defines mappings from key sequences to methods that will be called on the responder chain of any Cocoa application when executed while editing. To install this functionality, put these contents into a file named DefaultKeyBinding.dict and place the file in the directory: ~/Library/Keybindings. Notice that some of the bindings are to direct keys, such as C-v for pageDown:. While, other bindings are for a sequence of key-strokes, such as ESC-f for moveWordForward:,.
/* 
  File: DefaultKeyBinding.dict
  Author: Eric Bergerson (eb@object.com)
  Date: 10/30/01
  Location: ~/Library/Keybindings/DefaultKeyBinding.dict 
  Acknowledgements: thanks to Adam Swift for telling me where the hell
    this goes on OS X (they changed KeyBindings to Keybindings).
*/

{ /* Additional Emacs bindings */
	"^_" = "undo:"; /* Ctrl-_ */
	"^v" = "pageDown:";
	"^ " = "setMark:";
	"^w" = "deleteToMark:";
	"\033" = { 
		"f" = "moveWordForward:";  /* ESC f */
		"b" = "moveWordBackward:";  /* ESC b */
		"<" = "moveToBeginningOfDocument:";  /* ESC < */
		">" = "moveToEndOfDocument:";  /* ESC > */
		"v" = "pageUp:";  /* ESC-v */
		"d" = "deleteWordForward:";  /* ESC d */
		"/" = "complete:";  /* ESC / */
		"\033" = "complete:";  /* ESC ESC */
		"c" = "capitalizeWord:";
		"u" = "uppercaseWord:";
		"l" = "lowercaseWord:";
		"^h" = "deleteWordBackward:";  /* ESC Ctrl-H */
		"\010" = "deleteWordBackward:";  /* ESC backspace */
		"\177" = "deleteWordBackward:";  /* ESC delete */
	};
	"^x" = {
		"h" = "switchToCounterpartOfCurrentFile:";
		"^e" = "build:";
		"g" = "abort:";
		"^g" = "abort:";
		"'" = "nextBuildResult:"; /* Ctrl-' */
		"n" = "nextBuildResult:";
		"p" = "previousBuildResult:";
		"0" = "closeCurrentNavigator:";
		"x" = "swapWithMark:";
		"^s" = "saveDocument:";
	};

}

[ Developers Corner| Home| Products| Ordering| Support| Trademarks ]

Objective Technologies Inc.
90-07 68th Ave., Forest Hills, NY 11375
email: cs@object.com voice: 718.997.9741
Developers Corner: Line Range - Copyright (C) 1995-2008 Objective Technologies, Inc. ® All rights reserved.

NOTE: OTI does not warrant, guarantee, or otherwise assume any responsibility or accountability for any loss or corruption caused by any of the software or suggestions mentioned or available on this page. If something bad happens as a result of using this software, it's your own fault for using it. Please report any problems to cs@object.com