53

In Xcode, I am big fan of the assitant editor that shows me the corresponding .h or .m for the file that I am editing.

Is there a shortcut that allows me to swap focus between this two windows? I frequently switch between the two and using the mouse every time is annoying.

Jay
  • 6,572
  • 3
  • 37
  • 65
Alec Gorge
  • 17,110
  • 10
  • 59
  • 71

8 Answers8

101

New answer:

Move Focus To Editorcommandj followed by /// and return

This goes nicely together with commandshiftj which is Reveal in Project Navigator.

Old answer:

Use optioncommand` keyboard shortcut.

It can be remapped in Preferences - Keyboard Bindings - Move Focus To Next Area.

Edit: Removed XVim recommendation.

Rudolf Adamkovič
  • 31,030
  • 13
  • 103
  • 118
85

I made this to help answer another question... Does it help?

XCode shortcuts

Community
  • 1
  • 1
Robert
  • 37,670
  • 37
  • 171
  • 213
83

@Oneiros: Not quite what the OP was asking for..

I don't know of a 'short' shortcut but there's Cmd-J showing a popup where you can choose what to focus.

Jay
  • 6,572
  • 3
  • 37
  • 65
  • Cool, thanks. The correct answer wasn't exactly what I was looking for but it was close enough. – Alec Gorge Dec 28 '11 at 18:52
  • 3
    You might also want to check out `Cmd-Opt-.` and `Cmd-Opt-Shift-.` for the '*Move Focus to ..*' shortcuts - takes a while to discover all those shortcuts ;-) – Jay Oct 11 '12 at 07:11
  • 12
    In Xcode 8 you can use the new shortcut `Ctrl-\`` - Move Focus to Next Editor. See my answer below. – Marián Černý May 25 '17 at 07:56
25

Xcode 8+

This is the easiest option:

^` - Move Focus to Next Editor

When using multiple assistant editors, ^` moves focus to previous editor.

Xcode 4+

` - Move Focus to Next Area
` - Move Focus to Previous Area

Using this option you can switch between Project Navigator (left pane), Primary Editor, Assistant Editors, Utility Area (right pane), Debug Area, etc.


J - Move Focus to Editor...

Using this option you can choose where to move the focus using graphical navigation chooser.

Marián Černý
  • 15,096
  • 4
  • 70
  • 83
12

For Xcode 4.4: Use Cmd+Option+` (left to number 1) to Move Focus to Next Area, and use Cmd+Option+Shift+` to Move Focus to Previous Area

For Xcode 4.3: If you only have the Editor and Assistant open, use Cmd+Option+. to switch between them (Navigator>Move Focus to next area)

hyouuu
  • 2,471
  • 2
  • 27
  • 37
10

Also, if you want to open a different file in the right pane, like the .xib or any other, press

Command ⌘shift ⇧o

The open quickly window will appear, search the file, use capital letters to filter through camel case notation, then press

Alt ⌥enter ↵

The file will be opened in the assistant window

LightMan
  • 3,517
  • 31
  • 31
4

Switching between .h and .m:
Control ^Command ⌘Up Arrow ↑

Oneiros
  • 4,328
  • 6
  • 40
  • 69
  • Exactly what I wanted. I had a lot of trouble finding this hint. Perhaps I didn't make a good job of structuring my query. I didn't want to just change focus, but wanted to swap the contents of the two panes. This tip does exactly that. – Derek Knight May 19 '14 at 21:45
2

You can do this:

Assume you have Standart(S) and Assistance(A) editor opened and you want swap them.

1) Double tap with holded Alt to line in navigation bar of S editor with file name (look screenshot). This file will open in A editor.
2) In A editor tap Go Back and do 1. File from A editor will be opened in S editor.
3) In A editor tap Go Forward.

DONE!

Nike Kov
  • 12,630
  • 8
  • 75
  • 122