10

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!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ivy Xing
  • 284
  • 2
  • 8

5 Answers5

12

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 a left mouse click.

Other helpful hotkeys when it comes to editors are:

ctrl + ⌘ command + T - opens new vertical editor
ctrl + ⌥ option + ⌘ command + T - opens new horizontal 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 helpful Happy XCoding

Declan McKenna
  • 4,321
  • 6
  • 54
  • 72
Stoyan
  • 1,265
  • 11
  • 20
3

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.

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
2

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.

Xcode Key Binding

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.

Mussa Charles
  • 4,014
  • 2
  • 29
  • 24
2

Note: ⌘^⇧↩︎ switches between double and single editor mode.

To open assistant editor:

Use ⌘ + ^ + ⇧ + ↩︎ to switch to double editor mode

After using ⌘ + ⇧ + o to select a file, use

  1. ↩︎ to open in current focused editor OR
  2. Option + ↩︎ to open in assistant editor

(use ⌘ + J and then ← → to switch editor focus)

To close assistant editor:

⌘ + ^ + ⇧ + ↩︎ to switch back to single editor mode

Ivy Xing
  • 284
  • 2
  • 8
1

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

Des
  • 314
  • 3
  • 9