Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard shortcut for Jump to Definition

I'm looking for a keyboard only shortcut for Jump to Definition. The built-in shortcut requires the mouse: + Double click.

I've tried to add a regular keyboard shorcut for the Edit>Find>Jump to Defintion menu command, but, alas, it will only work when the method name is selected. I'd like to be able to position the cursor within the method name, class name, or other symbol, and hit something like +Shift+L.

Does anyone know of a solution, perhaps using a script, for the problem?

Update: The keyboard shortcut works sometimes and sometimes not. When I position the text cursor on a method call with no parameters and press +Shift+L it takes me to the definition. But it doesn't work for a method that takes an id parameter. However it works if the parameter is an int.

I have submitted a bug report to Apple.

like image 314
Arne Evertsson Avatar asked Feb 09 '10 10:02

Arne Evertsson


People also ask

How do I go to definition in Xcode?

Jump to definition directly To directly jump to a definition, you can combine ^ ctrl + ⌘ command + click .

What is the shortcut to jump over entire words at a time?

This simple keyboard shortcut allows you to jump over words while editing text in almost any Windows application. CTRL+Right arrow jumps the cursor forward to the next word while CTRL+Left arrow will move the cursor to the beginning of the previous word.

What is shortcut key to jump from page to another?

Alt or F10. To move to a different tab, use access keys or the arrow keys. Move the focus to commands on the ribbon. Tab key or Shift+Tab.

What is the shortcut for Ctrl A?

Alternatively known as Control+A, ^a, and C-a, Ctrl+A is a keyboard shortcut most often used to select all text, files, pictures, or other objects while in a graphical user environment. On Apple computers, the keyboard shortcut to select all is Command + A .


4 Answers

In Xcode 4.5.2 the shortcut now is ^ + + J (more readable Ctrl + Cmd + J).

like image 194
Thomas Kekeisen Avatar answered Oct 20 '22 10:10

Thomas Kekeisen


For Jump to Definition feature, you have the following 4 options:

  1. Ctrl + Command + J
  2. Ctrl + Command + Left Click (One finger tap)
  3. Command + Right Click (Two fingers tap)

XCode 9 only:

  1. Go to Xcode => Preferences => Navigation => Change Command-click on Code to Jumps to Definition and then use Command + Left Click (One finger tap)
like image 34
atulkhatri Avatar answered Oct 20 '22 11:10

atulkhatri


For XCode (tested in Swift) following keyboard shortcuts work. Found very useful:

To go to the Implementation (probably definition in Obj-C) :

Ctrl + Command + J

To pop back to Previous context :

Ctrl + Command +

To go to the Forward context :

Ctrl + Command +

like image 17
Feru Avatar answered Oct 20 '22 09:10

Feru


Change it in Xcode Preferences -> Navigation , NOT Key Bindings enter image description here

like image 5
Naishta Avatar answered Oct 20 '22 10:10

Naishta