82

Since a project can have hundreds of files inside dozens of directories (filters) shown on the "Project Navigator" panel, sometimes it's getting difficult to seek the file which is currently opened in the Editor (for example, when I jump from file to file via "CMD + clicking", etc).

Is there a way to automatically select currently opened file on the "Project Navigator" panel? I.e., automatically expand the directories (filters) and select the file there as I would have clicked on it? Maybe there's a shortcut or something?

Thanks.

Funbit
  • 1,591
  • 2
  • 14
  • 15
  • 2
    That's something I asked me often :D. It would be so cool if Apple could add an option to Xcode to make the check automatically, without me using the shortcut all the time. – Binarian Aug 27 '13 at 11:29

3 Answers3

171

The keyboard shortcut is -shift-J

Josh Hight
  • 1,833
  • 2
  • 12
  • 5
  • 15
    "Is there a way to automatically select currently opened file on the "Project Navigator" panel? I.e., automatically expand the directories (filters) and select the file there as I would have clicked on it?" – Thomas Besnehard May 23 '13 at 09:17
  • 3
    Wow, this has never been updated in all these years? Every other IDE has this. – Big_Chair Jun 10 '18 at 10:27
  • Game changer! Works in 10.1 – Resty Mar 14 '19 at 15:22
  • 12
    The fact that they realize this is useful enough to add a keyboard shortcut added to the fact the ever other IDE has this as @Big_Chair said, and to not put a setting to automatically do it is beyond belief. Xcode is very Microsoft-esque in its lack of basic usability features that have been around for years in other products. Huge half-trillion dollar companies can't make an IDE anywhere near as good as JetBrains! It's disgusting. Sorry I had to vent mho. :) – jbobbins Jul 23 '19 at 21:52
  • 1
    just to add to jbobbins opinion: i love and adore apple products and company, but i simply hate xcode, it is the worst development environment i have ever worked on, and i have worked on allot! they pay attention to meaningless things like folding code animation, but the very basic like marking (and keep marked) open and close brackets when you mark them, or keep tree in sync with open file... if it was just more like eclipse... – Shaybc Sep 17 '21 at 04:43
110

Right-click the file in the editor and choose Reveal in Project Navigator.

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • 30
    I found that this works for source files correctly but I didn't have the option for a xib file. To do this I used Josh's shortcut of ⌘-shift-J – Liam May 28 '13 at 12:35
0

Another option is to Right click anywhere within the Editor pane (with the source code) -> Navigate -> Reveal in Project Navigator.

Gaket
  • 6,533
  • 2
  • 37
  • 67