xcode 跳转到定义的键盘快捷键

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2228187/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:16:41  来源:igfitidea点击:

Keyboard shortcut for Jump to Definition

xcodekeyboard-shortcutsxcode3.2

提问by Arne Evertsson

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

我正在寻找Jump to Definition 的仅键盘快捷键。内置快捷方式需要鼠标:?+双击

I've tried to add a regular keyboard shorcut for the Edit>Find>Jump to Defintionmenu 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.

我已经尝试为Edit>Find>Jump to Defintion菜单命令添加一个常规键盘快捷键,但是,唉,它只在选择方法名称时才有效。我希望能够将光标定位在方法名称、类名称或其他符号内,然后点击?+ 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+Lit takes me to the definition. But it doesn't work for a method that takes an idparameter. However it works if the parameter is an int.

更新:键盘快捷键有时有效,有时无效。当我将文本光标定位在没有参数的方法调用上并按?+ Shift+ 时,L它会将我带到定义。但它不适用于带id参数的方法。但是,如果参数是int.

I have submitted a bug report to Apple.

我已向 Apple 提交了错误报告。

回答by Thomas Kekeisen

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

在 Xcode 4.5.2 中,快捷方式现在是^+ ?+ J(更具可读性Ctrl+ Cmd+ J)。

回答by atulkhatri

For Jump to Definitionfeature, you have the following 4options:

对于Jump to Definition功能,您有以下4 个选项:

  1. Ctrl+ Command+ J
  2. Ctrl+ Command+ Left Click(One finger tap)
  3. Command+ Right Click(Two fingers tap)
  1. Ctrl+ Command+J
  2. Ctrl+ Command+ Left Click(一根手指轻敲)
  3. Command+ Right Click(两指轻敲)

XCode 9 only:

仅限 XCode 9:

  1. Go to Xcode => Preferences => Navigation => Change Command-click on Codeto Jumps to Definitionand then use Command+ Left Click(One finger tap)
  1. 转到 Xcode => Preferences => Navigation => Change Command-click on CodetoJumps to Definition然后使用Command+ Left Click(单指点击)

回答by Feru

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

对于 XCode(在 Swift 中测试),以下键盘快捷键有效。发现非常有用:

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

转到实现(可能是 Obj-C 中的定义):

Ctrl+ Command+ J

Ctrl+ Command+J

To pop back to Previous context:

回到上一个上下文

Ctrl+ Command+ <

Ctrl+ Command+<

To go to the Forward context:

转到转发上下文

Ctrl+ Command+ >

Ctrl+ Command+>

回答by Ramashalanka

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

尝试以下方法:Cmd+ Option+ (或Cmd+ Shift+ D,并从列表中选择),或看到这个链接重新分配的快捷键(这最后一个选项可能是你已经尝试过的东西-它可能需要选择的方法)。

回答by Steven Gardner

May Be it can work

也许它可以工作

enter image description here

在此处输入图片说明

or try this way

或尝试这种方式

enter image description here

在此处输入图片说明