Monday 9 March 2015

Take the IntelliJ Challenge!

It's always a great idea to try and master the tools with which you work. I'm on a mission to improve my IntelliJ skills and have been watching and reading tutorials on IntelliJ tips and tricks. One of the very best I've come across so far is this video by Hadi Hariri. As well as being very informative it is also entertaining and Hariri's presentation skills make the video anything but boring.  I encourage you to watch the video when you have a spare hour.

The challenge

Hariri, basically challenges IntelliJ users to take on these challenges:
  • Use IntelliJ without touching your mouse.
  • Use IntelliJ with only one open tab. 
To use IntelliJ without a mouse requires mastery of keyboard shortcuts. Once you've learnt them you will find that it's way more productive than taking your hands off the keyboard and fiddling with your mouse. I've tried really hard to manage completely without a mouse forcing myself to learn the keyboard short-cuts. It's actually really difficult - but worth it.  I can't say I'll ever get to the point where I won't use the mouse at all but if I can get my most frequent mouse operations down to fast keyboard short-cuts I would consider that mission accomplished.  

Using IntelliJ with just one tab (this can be configured in preferences - search for 'tab limit') is a very interesting idea. I've been working on this for a couple of weeks and it actually makes a lot of sense. My preferred coding configuration is to maximise the editing area (CNTRL SHIFT F12) and then split the screen vertically (right click on the tab header).  In this way I can see the code I'm working on as well another class.

The following table summarises the tips, tricks and keyboard shortcuts that were presented in the video, many of which I use frequently when attempting not to use my mouse. Some of these will be known to pretty much anyone who is not an IntelliJ novice but others are more obscure and all are pretty useful.

All the key bindings in this table are for MacOsx 10.5+. To bring up the key bindings menu enter CNTRL ~ for obvious reasons this command is the same for all key bindings. 

ModifiersKeyCommand DescriptionComment
SHIFT CMDaFind keyboard shortcut
CMDoOpen a typeType in Camel case letters for search
CMD SHIFToOpen a file
CMD ALToOpen a symbol
CMD1Focus project explorerEsc focus back in editor
SHIFT SHIFTSearch everywhere
CMD F12Show class membersCMD F12 again to show inherited members
F4Move from project window to editor
CMDeRecently viewed files
SHIFT CMDeRecently edited files
CNTRLTABSwitch to last viewed window forwards
CNTL SHIFTTABSwitch to last viewed window backwards
CNRLbGo to type declaration
CMD yView type declaration
ALT CMDbView all implementations
CMD[Go back to last cursor point
CMD]Go forward to cursor point
CMD SHIFTF12Maximise editorCMD SHIFT F12 to toggle back
CMD CMDShow all windows (if they are hidden)
SHIFTF4Extract the editor as new window
CMD SHIFTRIGHT ARROWresize project window wider
CMD SHIFTLEFT ARROWresize project window narrower
ALTUP ARROWsemantic selection increase
ALT DOWN ARROWsemantic selection decrease
ALT SHIFTUP ARROWmove highlighted code up
ALT SHIFTDOWN ARROWmove highlighted code down
CMDdduplicate current line
CMDBACKSPACEdelete current line
SHIFTENTERinsert new line under current
ALT SHIFTENTERinsert new line above current
ALT SHIFTMOUSE CLICKmulti caret support
CNTRL CMDgmulti carti selecting each instance
CNTRLgmove to next instance of highlighted
CNTRL SHIFTgmove to previous instance of highlighted
ALT CMDlcode reformatting
CMD wcloses a tab
CNTRLSPACEcode completion
CNTRL SHIFTSPACEsmart code completion
CNTL ALTvintroduce a variable
ALT ENTERGeneral help and useful completionse.g. create Test and fix errors
F2Go to next error or warning
SHIFTF2Go to previous error or warning
CMD rSearch and replace
ALT F12Bring up a terminal
CNTRLvGit menu
CNTRL SHIFTr Run this class
CNTRL SHIFTdDebug this class

If there are any other useful ones that you use frequently please let me know and I'll add them to the list!

A few other notes of interest:
  • Help -> Productivity Guide keeps track of what you do and by sorting on the functionality that you have not used can show you functions you probably didn't realise were available.
  • Help -> Default keyboard reference gives you a full list of keyboard short cuts
  • Post fix completion is fantastic. e.g. if you have an int i type i.fori to generate a for loop. Or if you have an Object obj type obj.notnull to generate a null check.  There are loads of other to investigate like try which generates a try catch.
  • If you are demoing or pair programming and want people watching to see your keyboard shortcuts use the presentation assist plugin which will highlight your keyboard shortcuts on the screen.
  • View -> PresentationMode makes your code much bigger and also useful for demos.
  • The gears icon in the project explorer allow you to automatically scroll from the project window to the editor view and visa versa.  I always select those options.  You can also select to see methods as well as classes in the project window.

Hope you found this useful and that taking on the IntelliJ challenge improves your productivity.  Please use the comments section for your favourite IntelliJ tips.


  1. Set tab limit to 'None' and enter distraction free mode (comes in IDEA 14.1) - pure zen :)

    BTW, here's a fun guide to IDEA I wrote some time ago: -- must be useful for those who are just starting with IntelliJ IDEA but also for those who are familiar with the IDE

  2. Thanks for the reference to your blog post. It looks great and I look forward to giving it the attention it deserves.

    The only problem I could foresee with having no tabs, is that it might not always be obvious which file you are in. This is the case much more when you're editing text files you have as resources rather than when you are editing Java classes when you really ought to know which file you have open. But I'll certainly give it a go and see what happens.

  3. A very effective way to remind you anytime of existing shortcuts is using key promoter:

    Beware: may get on your nerves sometimes ;-)

  4. Nice one! For me - Ctrl (Cmd) + E (Recent files) helps the most to navigate without mouse.

    Got a 5min guide with some tips for IntelliJ IDEA:

    Someone could find it useful as well.

  5. Unfortunately, it is very hard to navigate inside many IDE dialogs via keyboard. For example in Run Configurations I have no way to focus on + to add new configuration button without mouse and Enter key always closes window instead of button activation.

  6. I think it's an easy work this day. Since google started sharing their APK online for playing games like geometry dash etc.

  7. iOS 12 is already under development. We are soon going to have the first iOS 12 beta available for iPhone and iPad devices. You can learn more about upcoming update from here.