Software Development

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.

Screen Shot 2015-03-09 at 17.15.29

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.

Screen Shot 2015-03-09 at 17.29.39

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
CMDF12Show 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
CMDyView type declaration
F1Javadoc
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
ALTDOWN 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
CMDwcloses a tab
CNTRLSPACEcode completion
CNTRL SHIFTSPACEsmart code completion
CNTL ALTvintroduce a variable
ALTENTERGeneral help and useful completionse.g. create Test and fix errors
F2Go to next error or warning
SHIFTF2Go to previous error or warning
CMDfSearch
CMDrSearch and replace
ALTF12Bring up a terminal
CNTRLvGit menu
CNTRL SHIFTrRun 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.

Reference: Take the IntelliJ Challenge! from our JCG partner Daniel Shaya at the Rational Java blog.

Daniel Shaya

Daniel has been programming in Java since it was in beta. Working predominantly in the finance industry he has created real time trading and margin risk applications. He is currently a director at OpenHFT where we are building next generation Java low latency products.
Subscribe
Notify of
guest

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

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Przemek
Przemek
9 years ago

Hi, can you provide the link to mentioned video of Hadi Hariri ?

Back to top button