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

不想你离开。 提交于 2019-12-04 07:20:59

问题


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:

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

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

  • TextMate: Cmd + T -> Go to File

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

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


回答1:


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




回答2:


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




回答3:


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

Cmd + alt + J

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

Cmd + shift + J Just opens the project navigator.




回答4:


Updated to Xcode 9.3

This is the quick guide for all the Xcode Keyboard Shortcuts, remind me if I missed anything in comments :)

Comment/ Un-comment code : Command + /

Undo : Command + Z

Redo : Command + Shift + Z

Shift Right or Left : Command + [ or ]

Indent : Control + I

Navigate to the beginning or end of line : Command + Left/Right Arrow

Navigate word by word left or right of line : Option + Left/Right Arrow

Bring up possible auto-completion choices : esc

Jump To definition : Command + Click

Put a breakpoint to a line : Command + \

Move line up or down: Option + Command + [ or ]

Find in File : Command + F

Find & Replace in File : Command + Option + F

Find in Project : Command + Shift + F

Find & Replace in Project : Command + Option + Shift + F

New Tab : Command + T

Next Tab : Command + Shift + {

Previous Tab : Command + Shift + }

Open Quickly : Command + Shift + O

Move Focus to Editor : Command + J

Navigate to Next File in Recently Visited : Command + Control + Right Arrow

Navigate to Previous File in Recently Visited : Command + Control + Left Arrow

Show present file in Editor : Command + Shift + J

Fold/ Unfold code : Command + Option + Left or Right Arrow

Fold/ Unfold all methods/functions: Option + Shift + Command + Left or Right Arrow

Fold/ Unfold all multiple line comments : Control + Shift + Command + Left or Right Arrow

Font Size Increase/Decrease : Command + or -

Go to line number : Command + L

Show Assistant Editor : Command + Option + Return

Hide Assistant Editor : Command + Enter

Toggle Completions : Control + Space

Edit All in Scope : Command + Control + E

Show / Hide Navigator : Command + 0

Switch Tabs : Command 1-8

When clicking a File in Navigator open in

Assistant Editor : Option + Click New Window : Double click Decide where to open : Shift + Option + Click

Toggle Debug Area : Command + Shift + Y

Next Issue : Command + ’

Previous Issue : Command. + ”

Toggle Breakpoints : Command + Y

Clear Console : Command + K

Show / Hide Utilities : Command + Option + 0

Switch Tabs Utilities : Command + Option + 1-9

Build : Command + B

Run : Command + R

Stop : Command + .

Analyze : Command + Shift + B

Test : Command + U

Clean : Command + Shift + K

Help for Clicked Symbol : Option + click

Documentation for clicked Symbol : Option + Double click

Show Documentation : Command + Shift + 0

Documentation for Selection : Command + Option + Control + /

Move Focus to Filter in Navigator : Command + Option + J

Move Focus to Filter in Utilities : Command + Option + L

Cheers :)




回答5:


File → Open Quickly...

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

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




回答6:


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



来源:https://stackoverflow.com/questions/2828262/is-there-a-go-to-file-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!