PyCharm/IntelliJ: Locate current open file in Project view
By default Always Select Opened File or Autoscroll from Source is disabled in PyCharm/IntelliJ. In this tutorial, I'll show you how to enable it and locate the current open file in the project structure. In other words:
- How to show current file in Project view?
- Autoscroll from Source not working?
Have in mind that settings might change with the versions - this aricle is written and tested against PyCharm and IntelliJ 2019.3+.
It seems that old options: Autoscroll from/to source were remove/changed for: Always Select Opened File and Select Open File
Step #1: Autoscroll from Source once
If you don't want to change the default behavior of PyCharm and IntelliJ then you can simply locate the current open file by keyboard combination. In this case you can use:
- ALT + F1
- 1
Note: Combination: ALT + F1 is reserved for Linux - show desktops. So you need to change the Linux or IDE behavior
As alternative you can use the Select Open File button by:
- PyCharm/IntelliJ
- Open Project Pane - ALT + 1
- Click the snipper at the top(check the post image)
- this button is not visible in some cases - for example if the Always Select Open File is enabled in this Project.
Step #2: Change Always Select Opened File Project settings
If you like to change the Project settings in order to locate the open file you can apply the next steps:
- PyCharm/IntelliJ
- Open Project Pane - ALT + 1
- Click the gear wheel at the top
- Check Always Select Opened File
Step #3: Change Always Select Opened File for all Projects
Finally if you like to preserve this change for new projects you can use plugin. The plugin is called: Autoscroll Save. You can install it by:
- PyCharm/IntelliJ
- Settings - CTRL + ALT + 1
- Plugins
- Marketplace
- find and install the plugin
This is how the plugin is described:
- Toggle
- "Autoscroll to Source": Crtl-Alt-Shift PAGE UP
- Toggle
- "Autoscroll from Source": Crtl-Alt-Shift PAGE DOWN
- Save
- "Autoscroll to/from Source" settings: Crtl-Alt-Shift END
Use the toggle actions to quickly enable / disable autoscroll settings in the active project.
Save the autoscroll settings to apply them to currently open projects and all projects opened or created in future.
The key bindings can be re-assigned via
- Settings
- Keymap
- search for "autoscroll"