Xcode Assign shortcut keys to context menu items

1

I want to assign a shortcut key to the "Jump To Definition" context menu item in XCode.

How?

bobobobo

Posted 2009-11-09T18:20:15.010

Reputation: 4 632

Answers

2

You did not mention which version of Xcode you are using, but here is how to do it in Xcode 2.5 (on 10.4/Tiger):

Since Jump to Definition is also an item in the Find menu, we can easily customize its binding. The item in the Find menu has the same effect as the menu item in the contextual menu. You can do this kind of main menu item key binding through System Preferences for applications that do not offer built-in binding customization.

  1. Xcode menu > Preferences…
    • Keybindings section (horizontal scroll area at the top of the preferences window)
    • Menu Key Bindings tab
    • Click the disclosure triangle for Find (make it point down)
    • Find Jump to Definition, double-click in its Key column
    • If you have not previously changed any key bindings, it will tell you that the currently selected binding set is owned by the system. If this dialog comes up:
      1. Click the Make Copy button
        • Enter a name for your key binding set
        • Again, double-click on the Key column for Jump to Definition
    • Press the key combination you want to use (e.g. Command-Shift-J).
    • Click on another line the Action/Key table to exit ‘key assignment mode’.
    • Click OK or Apply to activate the new key binding(s).

Chris Johnsen

Posted 2009-11-09T18:20:15.010

Reputation: 31 786

This works in the latest XCode as well (3.2.1 on Snow Leopard as of 1-25-2010). – alesplin – 2010-01-26T06:35:55.157

1

Or you could set it in your .pbxkeys keybindings file as something like

<key>^i</key><string>jumpToSelectionDefinition:</string>

niblha

Posted 2009-11-09T18:20:15.010

Reputation: 111

0

Although a little offtopic I found this article helpful since I was searching for a way to apply a shortcut ...

JJD

Posted 2009-11-09T18:20:15.010

Reputation: 177