By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy

Q: Shortcuts and live templates in IntelliJ IDEA

+13 votes

What kind of shortcuts and live templates do you use in IntelliJ Idea:

Can you please share some - so I can work faster :-) Thanks

asked in Java category by user hues
edited by user golearnweb

2 Answers

+6 votes
Best answer

Here are the shortcuts I use in my daily Java routine:

  • sout: System.out.println
  • souf: System.out.printf
  • fori: for loop
  • itar: for loop
  • iter: foreach loop
  • ALT+ENTER: Gives suggestions
  • ALT+INSERT: What kind of construction to implement with the code
  • CTRL+F5: Refreshes the console
  • CTRL+Q: Shows documentation offline
  • SHIFT+F1: Shows documentation online
  • CTRL+D: Copying the previous row on the current one (the cursor must be on the previous one)
  • CTRL+Y: Put the cursor on the row + CTRL+Y and it will delete it (the row)
  • CTRL+SHIFT+ARROW UP/ARROW DOWN: Moves the current row (on which is the cursor) to the upper or the row down below - inter-changing them with each other
  • CTRL+ALT+T: - Surround the code + CTRL+ALT+T - it will show you which options you can use/implement (IF, TRY-CATCH BLOCK, ETC.) - Surround the code with... (Live templates)
  • CTRL+ALT+L: Formatting the code - making it beautiful :-)
  • F2: Shows where is the error in the code - the cursor will go directly on the error
  • RIGHT CLICK >> Local History >> Show History: Shows the last changes (history - and you can choose which version to use)
  • CTRL+P: Put the cursor between the brackets (|) + CTRL+P: it will show you which parameters (values) you can use/put inside of the brackets ()
  • SHIFT+F6: Renames all variables at once (FIRST HAVE TO CHOOSE the variable you want to change/rename + SHIFT+F6)
  • Double-press Shift: Searches everywhere
  • CTRL+J: Inserts a live template
  • CTRL+ALT+J: Surrounds with a live template
  • CTRL+R: Find and replace
  • CTRL+E: Opens the recent file(s)
  • CTRL+J: Shows the available shortcodes
  • CTRL+SLASH (/): Commenting the code or line(s) of code; Remove comment - press again: CTRL+SLASH (/)

Here's one useful page as well:

You can also easily create your own Live Templates, shortcodes and abbreviations in IntelliJ (and JetBrains products);

Watch the video below to set your custom live template:

Also this video is useful (IntelliJ IDEA Tips and Tricks):

answered by user golearnweb
edited by user golearnweb
+4 votes

If you are teaching someone Java on IntelliJ you can use one very useful presentation plugin from the JetBrain repository called Presentation Assistant:

Just go to Help >> Find Action... >> type plugins >> choose  it >> choose Browse repositories >> type presentation assistant >> install it

answered by user ak47seo
edited by user golearnweb