69 Things You Should Know About Intellij Idea

69 Things You Should Know About Intellij Idea

About a while ago on one of the chat rooms at work someone posted a link to the video called IntelliJ IDEA Tips and Tricks. I’m a great fan of keyboard shortcuts but this video opened my eyes to some shortcuts I have never realised exists. The one problem with this video tho, is that that its a video :). If I want to have a quick look for some functionality I know I’ve seen in that video, finding it seems like impossible thing to do. Below you will find 69 shortcuts or other tips I have found in that video as well as a some I have added myself to the bunch.

Please note that this tips and tricks are used with the keyboard mapping “10.5+ for Mac OSX”. I also recommend you to install ‘Presentation Assistant’ plugin. (same as Hadi Hariri in his video)

You can download Anki Deck for learning those shortcuts quickly and permanently, available at the end of this post.

1. Cmd + , – Open up Preferences window

001

2. Cmd + O – Navigate to type
– entering type name navigate us to that type
– entering just a single letters from camel case notation does the same eg. instead of MyVeryLongClassName you can use MVLCN

002

3. Shift + Cmd + O Navigate to file, you can type slash to navigate folders as well, it takes wildcards and when you enter the type/file name and after that :40 you will end up on the 40th line in that file

003

4. Alt + Cmd + O Symbol lookup
Results with green background come from test files (all cmd+o commands)
Symbol lookup can be executed in specific namespace with ‘.’ eg ABC.someFloat where ABC is the abbreviation of specific class

004

5. Cmd + Shift + F Find in path (old-school way)
Have a look into preview window tab (IntelliJ 15 feature)

005

6. Double Shift – Search everywhere
Navigate all the different sections with tab
it searches everything like files, types, symbols but also plugins and all other stuff IntelliJ related
you can select entries previously typed with left/right arrow keys.
You can start run/debug your run configuration by entering its name and then hit enter or shift enter (for debug) – pretty cool stuff. By default it shows recent files.

006

7. Hint – switch off the tabs

007

8. Cmd + E recent files list

008
9. Shift + Cmd + E recently edited files

009

10. Cmd + ] or Cmd + [ Navigate forward/backward between files

010

11. Cmd + 1 – Go to project window (you can check other numbers for different windows)

011
12. Hint – Enable autoscroll from source so you always know where you are with the open file in the project (little cog icon on the project space)

012

13. Cmd + ` Next project window

013

14. When in eg. project window (Cmd + 1) pressing Esc puts the focus in the main editor
Pressing Cmd + Arrow Down – Go to source with focus in the editor straight away

014

15. Cmd + N – when in project window create a new file
Files and directories can be created with all directory structure if necessary
When in editor it will generate code (getters/setters/constructors etc.)

015

16. Alt + Ctrl + N – creates files etc but while the focus is in the editor

016

17. Cmd + Shift + N – create scratch file

017

18. Cmd + Shift + A – search for action

018

19. Shift + Cmd + F12 – hide all the window and leave editor only

019

20. Shift + Cmd + Right/Left arrow (while eg. in Project window) resizes the windows

020

21. Alt + Up arrow Select code (Alt + Down arrow shrinks selection)

021

22. Cmd + Shift + Up/Down arrows Move code around (single line or selection)

022

23. Cmd + D duplicate (line or the whole selection)

023

24. Shift + Cmd + V = clipboard history

024

25. Cmd + Backspace – delete the line

025

26. Alt + Shift + Click(s) – place multiple cursors

026

27. Ctrl + G (while symbol is selected) add selection for the next occurrence (multiple cursors apply), Shift + Ctrl + G unselects the selection
Ctrl + Cmd + G – selects all occurrences entering multiple inputs mode

027

28. Shift + F6 Rename

028

29. Ctrl + Alt + I – correct indentation (on selection)

029
30. Alt + Cmd + L – reformat entire file
There is an action ‘Code cleanup…’ where you can even cleanup entire project

030

31. Adjust code style with Selection + Alt + Enter (now you can check specific settings)

031
32. Alt + F1 – switch between views (or go to project view with the currently opened file)

0301

33. Highlight usages of the selected symbol -> Shift + Cmd + F70302
34. Alt + F7 show usages0303
35. Toggle bookmark – F3
Show Bookmarks – Cmd + F3 (you can delete the bookmark from here with backspace)

0304

0305
36. Go to line Cmd + L0306
37. Cmd + / – write comment ‘//’ and Shift + Cmd + / write comment ‘/* */’03070308
38. Cmd + T Update Project from source control

39. Language injections: Alt + Enter -> Inject Language, this works with multiple of options, common are JSON, HTML and RegExp (you can validate Regexp in place as well)

040

40. Smart completion Ctrl + Shift + Space (whereas Ctrl + Space is normal completion)

41. Cmd + P – get parameter info

041

42. Hippie completion – Alt + / (type one letter and then hit the key combination)

042

43. Live Templates -> Cmd + J, type a shortcut and then select (hit enter)

043

44. Surround Templates -> Cmd + Alt + T

044

45. Shift + Cmd + Enter – adds semicolon at the end of the line (only if there is no semicolon already)

045

46. Use postfix completion eg. type field and then start typing notnull (this will give you if check on null value)
Read more about postfix completion here: http://blog.jetbrains.com/idea/2014/03/postfix-completion/

046

47. Css style live templates in html pages: type #myDiv>ul>li*5 gives us a div with ul and five li elements in it (press Tab at the end of it)

047

48. Cmd + B Navigate to declaration

048

49. Cmd + U Navigate to super-method

049

50. Alt + Cmd + B shows implementations

050

51. Ctrl + H – opens type hierarchy window

051

52. Cmd + Shift + H – opens hierarchy on for a method

052

53. Cmd + F12 while in editor gives you a file structure (same as Cmd + 7)

053

54. Switch off navigation bar and invoke it if needed with Cmd + Up arrow

054

55. Hint – Check out Structural Search action

055

56. Hint – Check out Analyze menu -> Analyze code to/from here

056

57. Alt + Enter on SQL – you can select run query in console to see if the query is ok

58. Cmd + D while in version control window shows the diff

058

59. Cmd + K commit your changes

059

60. Ctrl + D starts debugger and F7 steps into (works with lambda expressions)

Ctrl + Shift + D starts debugger for the currently open file
Cmd + F2 stops the debugger

060

61. Hint – Evaluate expression in evaluate code window (while in debugger mode) works with Java 8 Lambdas too

061

62. Ctrl + T brings refactor menu

062

63. Alt + F12 opens up a terminal

063

64. Testing Restful web service with IntelliJ Idea build in REST Client (type in Cmd + Shift + A)

064

65. Ctrl + V – shows menu for version control operations

065

66. Ctrl + ` – quick change basic settings

066

67. Hint – Menu Help – you can get keyboard map pdf for reference or Menu Help – productivity guide

068 067

68. Shift + Ctrl + K -> push

69. You can try ‘Registry..’ settings (change the one ‘editor.zero.latency.typing’) to try out some experimental features (better don’t touch the rest of it – you have been warned)
Read more about it here: http://blog.jetbrains.com/idea/2015/08/experimental-zero-latency-typing-in-intellij-idea-15-eap/

069

 

For those of you who wants to learn them all by heart quickly I recommend using an Anki deck for it which I created. The deck can be downloaded from here: Anki Deck. If you don’t know Anki and flashcards based learning you can read more about it here. Enjoy!

2 responses on “69 Things You Should Know About Intellij Idea

  1. Merlin Santa November 26, 2015 at 1:26 pm

    This is so much of information. I find it hard to digest it. Anyway, thanks for sharing.

  2. Peter Kofler January 6, 2016 at 12:20 pm

    Krzysztof,
    thank you for the flashcards. What a great idea.

    I took your deck and translated the keys for the Windows version of IDEA. You can find them here.

Leave a Reply