在现代的ide中,有一个键盘快捷键,可以通过输入文件名称来打开文件,而不用把手放在鼠标上。例如:

Eclipse: Cmd|Ctrl + Shift + R ->打开资源 IntelliJ: Cmd|Ctrl + Shift + N ->打开文件

Xcode中有“转到文件”或“打开文件”快捷方式吗?


当前回答

更新到Xcode 9.3

这是所有Xcode键盘快捷键的快速指南:

Comment/ Un-comment code: ^ + / Undo: ⌘ + Z Redo: ⌘ + ⇧ + Z Shift Right or Left: ⌘ + [ | ] Indent: ⌃ + I Navigate to the beginning or end of line: ⌘ + ← | → Navigate word by word left or right of line: ⌥ + ← | → Bring up possible auto-completion choices: esc Jump To definition: ⌘ + Click Put a breakpoint to a line: ⌘ + \ Move line up or down: ⌘ + ⌥ + [ | ] Find in File: ⌘ + F Find & Replace in File: ⌘ + ⌥ + F Find in Project: ⌘ + ⇧ + F Find & Replace in Project: ⌘ + ⌥ + ⇧ + F New Tab: ⌘ + T Next Tab: ⌘ + ⇧ + { Previous Tab: ⌘ + ⇧ + } Open Quickly: ⌘ + ⇧ + O Move Focus to Editor: ⌘ + J Navigate to Next File in Recently Visited: ⌘ + ⌃ + → Navigate to Previous File in Recently Visited: ⌘ + ⌃ + ← Show present file in Editor: ⌘ + ⇧ + J Fold/ Unfold code: ⌘ + ⌥ + ← | → Fold/ Unfold all methods/functions: ⌘ + ⌥ + ⇧ + ← | → Fold/ Unfold all multiple line comments: ⌃ + ⇧ + ⌘ + ← | → Font Size Increase/Decrease: ⌘ + + | - Go to line number: ⌘ + L Show Assistant Editor: ⌘ + ⌥ + Return Hide Assistant Editor: ⌘ + ↩ Toggle Completions: ⌃ + Space Edit All in Scope: ⌘ + ⌃ + E Show / Hide Navigator: ⌘ + 0 Switch Tabs: ⌘ + 1 - 8 When clicking a File in Navigator open in Assistant Editor: ⌥ + Click New Window: Double click Decide where to open: ⇧ + ⌥ + Click Toggle Debug Area: ⌘ + ⇧ + Y Next Issue: ⌘ + ’ Previous Issue: ⌘ + ” Toggle Breakpoints: ⌘ + Y Clear Console: ⌘ + K Show / Hide Utilities: ⌘ + ⌥ + 0 Switch Tabs Utilities: ⌘ + ⌥ + 1 - 9 Build: ⌘ + B Run: ⌘ + R Stop: ⌘ + . Analyze: ⌘ + ⇧ + B Test: ⌘ + U Clean: ⌘ + ⇧ + K Help for Clicked Symbol: ⌥ + click Documentation for clicked Symbol: ⌥ + Double click Show Documentation: ⌘ + ⇧ + 0 Documentation for Selection: ⌘ + ⌥ + ⌃ + / Move Focus to Filter in Navigator: ⌘ + ⌥ + J Move Focus to Filter in Utilities: ⌘ + ⌥ + L

其他回答

这并不完全相同,但你可能会感兴趣:

Cmd + alt + J

打开项目导航器并突出显示搜索栏,准备输入。

Cmd + shift + J 只需打开项目导航器。

更新到Xcode 9.3

这是所有Xcode键盘快捷键的快速指南:

Comment/ Un-comment code: ^ + / Undo: ⌘ + Z Redo: ⌘ + ⇧ + Z Shift Right or Left: ⌘ + [ | ] Indent: ⌃ + I Navigate to the beginning or end of line: ⌘ + ← | → Navigate word by word left or right of line: ⌥ + ← | → Bring up possible auto-completion choices: esc Jump To definition: ⌘ + Click Put a breakpoint to a line: ⌘ + \ Move line up or down: ⌘ + ⌥ + [ | ] Find in File: ⌘ + F Find & Replace in File: ⌘ + ⌥ + F Find in Project: ⌘ + ⇧ + F Find & Replace in Project: ⌘ + ⌥ + ⇧ + F New Tab: ⌘ + T Next Tab: ⌘ + ⇧ + { Previous Tab: ⌘ + ⇧ + } Open Quickly: ⌘ + ⇧ + O Move Focus to Editor: ⌘ + J Navigate to Next File in Recently Visited: ⌘ + ⌃ + → Navigate to Previous File in Recently Visited: ⌘ + ⌃ + ← Show present file in Editor: ⌘ + ⇧ + J Fold/ Unfold code: ⌘ + ⌥ + ← | → Fold/ Unfold all methods/functions: ⌘ + ⌥ + ⇧ + ← | → Fold/ Unfold all multiple line comments: ⌃ + ⇧ + ⌘ + ← | → Font Size Increase/Decrease: ⌘ + + | - Go to line number: ⌘ + L Show Assistant Editor: ⌘ + ⌥ + Return Hide Assistant Editor: ⌘ + ↩ Toggle Completions: ⌃ + Space Edit All in Scope: ⌘ + ⌃ + E Show / Hide Navigator: ⌘ + 0 Switch Tabs: ⌘ + 1 - 8 When clicking a File in Navigator open in Assistant Editor: ⌥ + Click New Window: Double click Decide where to open: ⇧ + ⌥ + Click Toggle Debug Area: ⌘ + ⇧ + Y Next Issue: ⌘ + ’ Previous Issue: ⌘ + ” Toggle Breakpoints: ⌘ + Y Clear Console: ⌘ + K Show / Hide Utilities: ⌘ + ⌥ + 0 Switch Tabs Utilities: ⌘ + ⌥ + 1 - 9 Build: ⌘ + B Run: ⌘ + R Stop: ⌘ + . Analyze: ⌘ + ⇧ + B Test: ⌘ + U Clean: ⌘ + ⇧ + K Help for Clicked Symbol: ⌥ + click Documentation for clicked Symbol: ⌥ + Double click Show Documentation: ⌘ + ⇧ + 0 Documentation for Selection: ⌘ + ⌥ + ⌃ + / Move Focus to Filter in Navigator: ⌘ + ⌥ + J Move Focus to Filter in Utilities: ⌘ + ⌥ + L

文件→快速打开…

你可以在Preferences→Key Bindings中为它指定一个快捷方式。默认值为⌘+Shift+D。

(如果您有#include/#import,您可以将文本光标放在上面,并按⌘+Shift+D自动填充文件名。)

因为Xcode 4(包括5、6、7、8、9、10、11、12和13)是⌘+⇧+ O

还需要注意的是,如果你按住Command并点击一个类的名称,Xcode会跳转到这个类的实现。