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
Keyboard shortcut for Jump to Definition
提问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 id
parameter. 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 Definition
feature, you have the following 4options:
对于Jump to Definition
功能,您有以下4 个选项:
- Ctrl+ Command+ J
- Ctrl+ Command+ Left Click(One finger tap)
- Command+ Right Click(Two fingers tap)
- Ctrl+ Command+J
- Ctrl+ Command+ Left Click(一根手指轻敲)
- Command+ Right Click(两指轻敲)
XCode 9 only:
仅限 XCode 9:
- Go to
Xcode => Preferences => Navigation => Change
Command-click on Code
toJumps to Definition
and then use Command+ Left Click(One finger tap)
- 转到 Xcode => Preferences => Navigation => Change
Command-click on Code
toJumps 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+>