IntelliJ IDEA Tips & Tricks

This is a small post written after a presentation on Java User Group Graz regarding IntelliJ tricks.

The presentation is available here on Github and I want to summarize some interesting things that I didn’t know / forgot:

  1. Shift + Shift: “Search everywhere”. Nice and very powerful shortcut. Search in class names / file names / methods. Didn’t know.
  2. If you are stuck with too many editor tabs, then…  turn them off (Set tab position to None). Use Ctrl+E (recent files) instead. As a bonus you can search for the name of the file there (just type it)
  3. Close all tool windows, use Alt+1..9 to show them temporarily and Shift+Esc to close them.
  4. Instead of “Project Structure” tool window ( Alt+1 ) use the navigation bar: Alt+Home and then use arrows to navigate.
  5. Now you have the whole screen for editing, but chances are the code fills only the left part. You can use Split Screen Vertically to have two files opened simultaneously (or the same one). There’s no shortcut for that, use Ctrl+Shift+A and search for “split”
  6. In the “Project Structure” tool window go to settings and enable Autoscroll to Source and Autoscroll from source . Almost always useful.
  7. Useful plugins: Key Promoter X – detects what you do with a mouse and gives a notification window if you can do it with a keyboard shortcut.
  8. If you have a variable a then try typing a.null and pressing Enter. What you get is:
  9. if (a == null) { }
  10. Similarly a.notnull creates:if (a != null) { }

But there are many more, check Live Templates in settings

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.