Locate current file in IntelliJ

Keyboard ShortcutsIntellij Idea

Keyboard Shortcuts Problem Overview


How do I locate the current file in the project structure? (Similar to Visual Studio's Ctrl + Alt + L). What is the name of the operation (so I can define it in the keymap)

Keyboard Shortcuts Solutions


Solution 1 - Keyboard Shortcuts

Alt + F1 (or Alt + Shift + 1 for linux) almost does what you want. You need to hit Enter afterwards as IDEA allows multiple "targets" for navigation (project structure, file structure etc).

(Note you can also set AutoScroll to Source and AutoScroll from source using the two "boxes with arrows" buttons above the project structure view but this can get annoying when it shoves you into the JDK source because you followed a reference to java.io.File.

The keymap defines it as Select current file or symbol in any view.

Solution 2 - Keyboard Shortcuts

You can also click the little cross hairs button in the projects pane:

enter image description here

Note that the symbol won't be shown if Always Select Opened File (previously Autoscroll from Source) option is enabled.

Solution 3 - Keyboard Shortcuts

Click the gear in the Project tool window and then Always Select Opened File (previously Autoscroll From Source)

cogwheel menu

Solution 4 - Keyboard Shortcuts

"Select in project View"

Little to no memorization required, reusable for every action in Intellij:

Use Find Action:

  1. Press Shift + cmd + A (Pretty sure it's Shift + Ctrl + A for Windows and Linux)
  2. Type select in...
  3. Select Select in Project View in the suggestion list

enter image description here

Solution 5 - Keyboard Shortcuts

Do following will select your file automatically all time.

  1. Right click on Project/Packages area > Autoscroll to Source.
  2. Right click on Project/Packages area > Autoscroll from Source.

Please find image below.

enter image description here

Solution 6 - Keyboard Shortcuts

I am using IntelliJ IDEA 2016.2 Ultimate.

Alt+F1, then press 1

Solution 7 - Keyboard Shortcuts

And make it autoscrollable from source without hitting shortcuts every time https://stackoverflow.com/questions/11051692/how-to-make-scroll-from-source-feature-always-enabled

Solution 8 - Keyboard Shortcuts

There is no direct shortcut for such operation in IntelliJ IDEA 14 but you can install the plugin and set it the keyboard shortcut to the function that called "Scroll From Source" in keymap settings.

enter image description here

Solution 9 - Keyboard Shortcuts

In addition to the other options, in at least IntelliJ IDEA 2017 Ultimate, WebStorm 2020.2, and probably a ton of other versions, you can do it in a single shortcut.

Edit preferences, search for Select in Project View, and under Keymap, view the mapped shortcut or map one of your choice.

On the Mac, Ctrl + Option + L is not already used, and is the same shortcut as Visual Studio for Windows uses natively (Ctrl + Alt + L, so that could be a good choice.

Solution 10 - Keyboard Shortcuts

  1. Open the project explorer ( default left side )
  2. Click on the tiny wheel setting button
  3. Mark Auto scroll from source option.

Boom! You are done.

Solution 11 - Keyboard Shortcuts

If you are using Mac(OSX)

Based on the current tab, to select the file on project is : FN + OPTION + F1

Then in the popup you can Select in: Project View > Select In: Project

Solution 12 - Keyboard Shortcuts

In Intellij Idea Community edition 2020.1 :

  1. Right click on project header
  2. Select 'Always Select Opened File'

enter image description here

Solution 13 - Keyboard Shortcuts

in PyCharm 2021 this hotkey named Select File In Project View

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionripper234View Question on Stackoverflow
Solution 1 - Keyboard ShortcutsbutterchickenView Answer on Stackoverflow
Solution 2 - Keyboard ShortcutsTimo ReimannView Answer on Stackoverflow
Solution 3 - Keyboard ShortcutsRami KuretView Answer on Stackoverflow
Solution 4 - Keyboard ShortcutsericnView Answer on Stackoverflow
Solution 5 - Keyboard ShortcutsM PatelView Answer on Stackoverflow
Solution 6 - Keyboard ShortcutsJames GrahamView Answer on Stackoverflow
Solution 7 - Keyboard ShortcutsYauhenView Answer on Stackoverflow
Solution 8 - Keyboard ShortcutsPavelView Answer on Stackoverflow
Solution 9 - Keyboard ShortcutsErikEView Answer on Stackoverflow
Solution 10 - Keyboard ShortcutsSivani PatroView Answer on Stackoverflow
Solution 11 - Keyboard ShortcutsAsip AsipoView Answer on Stackoverflow
Solution 12 - Keyboard ShortcutsSmileView Answer on Stackoverflow
Solution 13 - Keyboard ShortcutsDaniil MashkinView Answer on Stackoverflow