Locate current file in IntelliJ

痴心易碎 提交于 2019-11-26 08:43:17

问题


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)


回答1:


Alt + F1 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.




回答2:


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

Note that the symbol won't be shown if the Autoscroll from Source option is enabled.




回答3:


Click the gear and then Autoscroll From Source




回答4:


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.




回答5:


And make it autoscrollable from source without hitting shortcuts every time How to make Scroll From Source feature always enabled?




回答6:


I am using IntelliJ IDEA 2016.2 Ultimate.

Alt+F1, then press 1




回答7:


Use Find Action (reusable; free up your precious memory):

  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




回答8:


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.




回答9:


  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.




回答10:


In addition to the other options, in at least IntelliJ IDEA 2017 Ultimate, and perhaps some earlier versions (I don't know), 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.




回答11:


If you are using mac

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

Then Select in: Project View > Select In: Project



来源:https://stackoverflow.com/questions/1086041/locate-current-file-in-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!