跳转到定义的快捷键

我正在寻找一个键盘快捷键只为 跳转到定义。内置的快捷键需要鼠标: + 双击

我已经尝试为 编辑 > 查找 > 跳转到 Defintion菜单命令添加一个常规的键盘快捷键,但是,唉,它只有在选择了方法名时才能工作。我希望能够将光标定位在方法名、类名或其他符号中,然后命中类似于 + Shift + L的内容。

有人知道解决这个问题的方法吗,也许是使用一个脚本?

更新 : 该快捷键有时有效,有时无效。当我在一个没有参数的方法调用上定位文本光标并按下 + Shift + L时,它将带我到定义。但是它不适用于接受 id参数的方法。但是,如果参数是 int,则它可以工作。

我已经向苹果公司提交了一份错误报告。

41963 次浏览

Try the following: Cmd+Option+ (or Cmd+Shift+D and select from list) or see this link re assigning shortcuts (this last option is probably what you tried already - it may require selecting the method).

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

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 +

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)

May Be it can work

enter image description here

or try this way

enter image description here

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