跳转到定义的键盘快捷键
我正在寻找一个仅用于跳转到定义的键盘快捷键。内置快捷方式需要鼠标:⌘ + 双击。
我尝试为“编辑”>“查找”>“跳转到定义”菜单命令添加常规键盘快捷键,但是,唉,它仅在选择方法名称时才起作用。我希望能够将光标定位在方法名称、类名称或其他符号内,然后点击类似 ⌘+Shift+L< /kbd>。
有谁知道解决该问题的方法,也许使用脚本?
更新:键盘快捷键有时有效,有时无效。当我将文本光标定位在不带参数的方法调用上并按 ⌘+Shift+L 时,它会将我带到定义。但它不适用于采用 id 参数的方法。但是,如果参数是 int,则它可以工作。
我已向 Apple 提交了错误报告。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 Xcode 4.5.2 中,快捷方式现在是 ^ + ⌘ + J (更易读 Ctrl + Cmd + J)。
In Xcode 4.5.2 the shortcut now is ^ + ⌘ + J (more readable Ctrl + Cmd + J).
对于
跳转到定义
功能,您有以下4选项:仅限 XCode 9:
Xcode =>偏好=>导航=>更改
按住 Command 键并单击代码
到
跳转到定义
,然后使用Command + 左键单击(用一根手指点击)For
Jump to Definition
feature, you have the following 4 options:XCode 9 only:
Xcode => Preferences => Navigation => Change
Command-click on Code
to
Jumps to Definition
and then use Command + Left Click (One finger tap)对于 XCode(在 Swift 中测试),可以使用以下键盘快捷键。发现非常有用:
转到实现(可能在 Obj-C 中定义):
Ctrl + Command + J
弹回到上一个上下文:
Ctrl + Command + ←
转到前向上下文 :
Ctrl + 命令 + →
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 + →
在Xcode Preferences -> 中更改它导航,非按键绑定
Change it in Xcode Preferences -> Navigation , NOT Key Bindings
尝试以下操作:Cmd+Option+↑(或Cmd+Shift+ D 并从列表中选择)或查看此链接重新分配快捷方式(最后一个选项可能是您已经尝试过的 - 它可能需要选择方法)。
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).
也许它可以工作
或尝试这种方式
May Be it can work
or try this way