In Xcode 11, what are the keyboard shortcuts to open/change file in assistant editor?

不羁岁月 提交于 2020-02-03 05:42:06

问题


Seems like we can use ^⇧⌘↩︎ to focus/unfocus current editor, though even when the current editor gets unfocused, I'm not sure how to control what gets opened in the assistant editor.

I would like to know the keyboard shortcuts for:

  1. Open a specified file in assistant editor.
  2. After assistant editor is opened, change which file gets displayed in assistant editor.

Thank you!


回答1:


So if you want to open a file in specific editor from the project navigator, you have to hold ⌥ option + ⇧ shift and click the file. Then a "destination chooser" will be shown and it will highlight the editor or spaces in between two editors in which it will load the file. You can change the highlight with the arrow keys or with the mouse and confirm your selection with either Enter or left mouse click.

Other helpful hotkeys when it comes to editors are:

ctrl + ⌘ command + T - opens new horizontal editor
ctrl + ⌥ option + ⌘ command + T - opens new vertical editor
ctrl + ⌥ option + ⌘ command + W - closes the highlighted editor
ctrl + ⇧ shift + ⌥ option + ⌘ command + W - closes all other editors except the highlighted editor
⌘ command + J - brings the editor chooser and you can select a new editor to focus onto with the arrow keys or with the mouse and confirm your selection with either Enter or left mouse click.

in addition to that you can bring an 'assistant editor' for every ordinary editor with ctrl + ⌥ option + ⌘ command + Enter and hide it with the same keys

I hope these are helfpul Happy XCodding 🙂




回答2:


In Xcode 11, you can not manually set the assistant file. It is always automatic.

But if you need to open a file side by side of the main editing file you can:

⌥ option click on the file.

or

⌥ option+Enter when you highlight the file in Open Quickly menu (Use ⌘ command+⇧ shift+O to open the "Open Quickly")

Also ⌘ command+j will help you to chose where to focus and ⌘ command+⌥ option+, changes toggles left or right editor as primary, so any file opens in the primary afterward.




回答3:


Opening in a New Window

In addition to Stoyan's great answer, if you want the destination to be a new window then press the following when you've entered destination picker mode:

shift ⇧ + command ⌘ + T to open in a new window


Opening destination in another (already open / non active) window

When you have more than one window open and you want to choose a destination that's not in the already selected window, then use the OSX window switching shortcut while in destination picker mode:

command ⌘ + `

I've always used this feature, so happy it's still in Xcode 11




回答4:


Pro Tip: You can always see the list of all available shortcuts on: -

Xcode -> Preferences -> Key Bindings

Then search the shortcut you want via the search bar.

Try to learn/muscle memorize new shortcuts on need to use basis ie if you find yourself performing certain action repetitively then maybe it's time for having a shortcut for that then visit the shortcut list or even make your custom shortcuts for that tasks.



来源:https://stackoverflow.com/questions/58070236/in-xcode-11-what-are-the-keyboard-shortcuts-to-open-change-file-in-assistant-ed

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