Xcode 中有 [Go to file...] 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2828262/
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:24:15  来源:igfitidea点击:

Is there a [Go to file...] in Xcode?

xcodekeyboard-shortcuts

提问by Mike

In every modern day IDE and text editor, there is an action to open a file without putting your hand on the mouse. For example:

在每个现代 IDE 和文本编辑器中,都有一个操作可以打开文件而无需将手放在鼠标上。例如:

  • Eclipse: Cmd|Ctrl+ Shift+ R-> Open Resource

  • IntelliJ: Cmd|Ctrl+ Shift+ N-> Open File

  • TextMate: Cmd+ T-> Go to File

  • 日食:Cmd| Ctrl+ Shift+ R-> 打开资源

  • 智能:Cmd| Ctrl+ Shift+ N-> 打开文件

  • TextMate:Cmd+ T-> 转到文件

In Xcode, I have found no such options. Please, please tell me I just overlooked it in my growing frustration.

在 Xcode 中,我没有发现这样的选项。拜托,请告诉我,我只是在越来越沮丧的时候忽略了它。

Is there a "Go to file" or "Open File" shortcut in Xcode?

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

回答by Eimantas

Since Xcode 4 (including 5, 6, 7, 8, 9, 10 and 11) it's ?+ ?+ O

由于 Xcode 4(包括 5、6、7、8、9、10 和 11)它是?+ ?+O

回答by djones

Command+ Shift+ Ois now the shortcut to find a file quickly and open it in Xcode 4

Command+ Shift+O现在是快速查找文件并在 Xcode 4 中打开它的快捷方式

回答by Nils Munch

Its not quite the same, but this might interest you:

它不完全相同,但这可能会让您感兴趣:

Cmd+ alt+ J

Cmd+ alt+J

Opens the project navigator and highlights the search bar, ready to type.

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

Cmd+ shift+ JJust opens the project navigator.

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

回答by Rein rPavi

Updated to Xcode9.3

更新到 Xcode9.3

This is the quick guide for all the Xcode Keyboard Shortcuts:

这是所有 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

  • 注释/取消注释代码:^+/

  • 撤消:?+Z

  • 重做:?+ ?+Z

  • 右移或左移:?+ [|]

  • 缩进:?+I

  • 导航到行首或行尾:?+ |

  • 在行的左边或右边逐字导航:?+ |

  • 调出可能的自动完成选项: esc

  • 跳转到定义:?+ 单击

  • 在一行上放置一个断点:?+\

  • 向上或向下移动行:?+ ?+ [|]

  • 在文件中查找:?+F

  • 查找和在文件替换:?+ ?+F

  • 在项目中查找:?+ ?+F

  • 查找和在项目替换:?+ ?+ ?+F

  • 新标签:?+T

  • 下一个标签:?+ ?+{

  • 上一个标签:?+ ?+}

  • 快速打开:?+ ?+O

  • 将焦点移至编辑器:?+J

  • 导航到最近访问的下一个文件:?+ ?+

  • 导航到最近访问中的上一个文件:?+ ?+

  • 显示当前文件编辑器:?+ ?+J

  • 折叠/展开代码:?+ ?+ |

  • 折叠/展开所有方法/功能:?+ ?+ ?+ |

  • 折叠/展开所有多行注释:?+ ?+ ?+ |

  • 字体大小增加/减少:?+ +|-

  • 转到行号:?+L

  • 显示助理编辑:?+ ?+Return

  • 隐藏助理编辑:?+?

  • 切换完成:?+Space

  • 编辑所有范围:?+ ?+E

  • 显示/隐藏导航器:?+0

  • 切换标签:?+ 1-8

  • 单击导航器中的文件打开时

  • 助理编辑:?+ 点击

    • 新窗口:双击
    • 确定打开位置:?+ ?+ 单击
  • 切换调试区:?+ ?+Y

  • 下一期:?+'

  • 上一期:?+

  • 切换断点:?+Y

  • 清除控制台:?+K

  • 显示/隐藏实用程序:?+ ?+0

  • 切换标签实用程序:?+ ?+ 1-9

  • 构建:?+B

  • 运行:?+R

  • 停止:?+.

  • 分析:?+ ?+B

  • 测试:?+U

  • 清洁:?+ ?+K

  • 单击符号的帮助:?+ 单击

  • 单击符号的文档:?+双击

  • 查看文档:?+ ?+0

  • 选择文件:?+ ?+ ?+/

  • 将焦点移至导航器中的过滤器:?+ ?+J

  • 将焦点移到在公用事业过滤器:?+ ?+L

回答by kennytm

File → Open Quickly...

文件 → 快速打开...

You can assign a shortcut to it in Preferences → Key Bindings. The default should be ?+Shift+D.

您可以在首选项 → 键绑定中为其分配快捷方式。默认应该是?+ Shift+ D

(If you have a #include/#import, you can place the text cursor on it and press ?+Shift+Dto fill the file name automatically.)

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

回答by Jeffrey Wear

Also note that if you hold down Command and click on the name of a class, Xcode will jump you to that class' implementation.

另请注意,如果您按住 Command 键并单击某个类的名称,Xcode 将跳转到该类的实现。

回答by Yogendra Singh

If you want to jump to specific line in specific file. Then

如果要跳转到特定文件中的特定行。然后

First: Command + Shift + o

第一:Command + Shift + o

Then type CustomView:60

然后输入 CustomView:60

Means in file CustomView line number 60.

表示文件 CustomView 行号 60。