I decided to write this post after watching Hadi Hariri’s talk at Geekout 2014 called “Mouseless Driven Development”
According to Hadi, it is possible to code in Intellij Idea without even touching a mouse. I can believe it.
In the post I am going to present some nice tricks which I use on my daily work with Intellij Idea and the new ones that I learned during the talk.
Writing this post I was using Intellij Idea 13 so some of the shortcuts may not be available in the older versions.
- CTRL+N – brings a class name finder. You can type camel case and it finds the appropriate class. However it is also possible to put colon after the class name followed by a number and it takes you to the class and goes to the line specified by the number entered.
- CTRL+SHIFT+N – brings a file name finder which you can use in the same way as CTRL+N.
- CTRL+SHIFT+ALT+N – brings a symbol finder.
As you can see there are a few consumeFloat() methods and if you want to go to the particular symbol name you enter class name before the symbol:
- double SHIFT – brings a “Search Everywhere” window, search not only classes and files but you can look for some settings.
- ALT+1 – goes to Project Explorer and like in any other window or toolbar you can actually type letters and that finds an appropriate item.
- CTRL+F12 – brings a popup which allows to navigate to different symbols/methods in the current file or class.
- CTRL+E – brings a popup with the recent opened files.
- CTRL+SHIFT+E – brings a popup with the recent edited files.
- CTRL+TAB – allows you to switch to different windows, etc.
- CTRL+B – when cursor is placed on the item in the class, it takes you to the declaration.
- CTRL+ALT+LEFT/RIGHT – allows you to go back and forward where you have been before.
- CTRL+SHIFT+I – brings a quick popup window with an item definition.
- CTRL+ALT+B – goes to the implementation if there is one or displays pop up with all implementations available.
When navigating between files in the project explorer with UP/DOWN keys you can press ENTER and it shows a current item in the editor without moving focus to the editor. However, F4 pressed opens item in the editor and moves focus to that editor. Very efficient way to navigate through project without touching a mouse.
- CTRL+ALT+F7 – brings a quick pop up showing usages of the current item in the project.
- CTRL+SHIFT+F7 – highlights usages of the selected item; when used on the throw it highlights all the places in the current method where the exception is thrown; when used on the return statement it shows all the places where the method exits.
- CTRL+SHIFT+F12 – hides all opened windows and maximizes the editor, entering shortcut again brings the closed windows back
- CTRL+SHIFT+LEFT/RIGHT – entered when you are in the project explorer it resizes the editor; very nice feature – give it a try.
- CTRL+W – expands context sensitive selection.
- SHIFT+ALT+UP/DOWN – moves text up and down; it is context sensitive so where you place cursor on for loop for instance it moves up and down the whole loop.
- CTRL+SHIFT+ENTER – intelligently completes current statement (for example adds semicolon at the end of the statement).
- CTRL+ALT+T – brings a “Surround With” popup which gives you a few options of code insertions; works not only for Java but for other technologies (HTML, etc.) as well.
- CTRL+SHIFT+SPACE – smart completion which filters the list of available methods or variables to match the expected type.
- CTRL+J – inserts a live template; the shortcut is context sensitive and gives you different options when pressed on the variable or for example in an empty space in the editor; even if you not defined your own templates, those built in are worth looking at.
- CTRL+SHIFT+ALT+T – brings a refactor popup; unfortunately it is not context sensitive.
- SHIFT+F2/F2 – goes to the next/previous highlighted error, however it works that way only if the following option is checked in:
- ALT+F12 – opens operating system terminal inside IDE.