views:

42

answers:

2

New to the Mac (OS X 10.6.2), and Xcode (3.2.1), (and new here!), I've been tinkering with the shortcuts, using the procedures described here.

I made the folders mentioned, and the file PBKeyBindings.dict:

/* ~/Library/KeyBindings/PBKeyBinding.dict */
{
"^f"      = "moveWordForward:";            /* Ctrl-f    = next word     */
"^j"      = "moveWordForward:";
}

This was just to test the water, before embarking on stuff like:

{
"^$K" = (
    "selectLine:",
    "cut:"
);
"^$D" = (
    "selectLine:",
    "copy:",
    "moveToEndOfLine:",
    "insertNewline:",
    "paste:"
);

} (copied from another post, thanks)

Now, whatever I did (restart Xcode, restart Mac), Xcode took no notice.

Have I just done something daft, or has the whole facility been removed by the Mighty Ones?

Incidentally, another user has suggested that this can be done in Xcode Preferences, but I can't see a way of mapping multiple actions onto a key.

A: 

All is well, a spelling mistake even more vital than those kindly corrected by cdespinosa.

The file to hold the key bindings is ~/Library/KeyBindings/PBKeyBinding.dict.

The concept is discussed in the following document, located by search in the docset for pbkey:

/Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html

John White
A: 

If you want to make Command-D perform duplicate line (a la Jetbrains IDEs) do the following:

/* ~/Library/KeyBindings/PBKeyBinding.dict */
{
    "@d" = (
        "selectLine:",
        "copy:",
        "moveToEndOfLine:",
        "insertNewline:",
        "paste:",
        "deleteBackward:"
    );
}

Then, you'll need to remap the default Command-D (instructions for OS X 10.6):

  1. Open System Preferences | Keyboard | Keyboard Shortcuts
  2. Add an application shortcut by clicking the "+" button
  3. Browse to XCode.app (in /Developer/Applications)
  4. Set Menu title to "Add to Bookmarks" and type a different/unique shortcut combo (e.g., "Ctrl + Shift + D")
AlexD