Reputation: 230038
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)
Upvotes: 470
Views: 151044
Reputation: 3719
Click the gear ⚙️ in the Project tool window and then Always Select Opened File (versions prior to 2020.1: Autoscroll From Source):
Upvotes: 169
Reputation: 6763
In 2023 there is still no default shortcut for locating the current file in the Project view. However it is easy to set up a custom shortcut for it.
Open Settings, go to Keymap and search for "Select file in project view". It should be in the "Other" section and should have a crosshair icon. Right click on it and select "Add keyboard shortcut". I set it up to CTRL + SHIFT + L
, but of course any unmapped key combination will work.
Enjoy! For me this is a very often used feature and having a shortcut for it is a significant productivity boost.
Upvotes: 2
Reputation: 13883
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.
Upvotes: 657
Reputation: 59
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
Upvotes: 5
Reputation: 50231
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.
Upvotes: 12
Reputation: 13103
"Select in project View"
Little to no memorization required, reusable for every action in Intellij:
Use Find Action:
Upvotes: 41
Reputation: 9807
You can also click the little cross hairs button in the projects pane:
Note that the symbol won't be shown if Always Select Opened File (previously Autoscroll from Source) option is enabled.
Upvotes: 503
Reputation: 4088
In Intellij Idea Community edition 2020.1 :
Upvotes: 5
Reputation: 424
Do following will select your file automatically all time.
Please find image below.
Upvotes: 23
Reputation: 119
Boom! You are done.
Upvotes: 8
Reputation: 5162
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.
Upvotes: 12
Reputation: 2535
And make it autoscrollable from source without hitting shortcuts every time How to make Scroll From Source feature always enabled?
Upvotes: 17