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
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
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
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
5. Cmd + Shift + F Find in path (old-school way)
Have a look into preview window tab (IntelliJ 15 feature)
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.
7. Hint – switch off the tabs
8. Cmd + E recent files list
9. Shift + Cmd + E recently edited files
10. Cmd + ] or Cmd + [ Navigate forward/backward between files
11. Cmd + 1 – Go to project window (you can check other numbers for different windows)
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)
13. Cmd + ` Next project window
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
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.)
16. Alt + Ctrl + N – creates files etc but while the focus is in the editor
17. Cmd + Shift + N – create scratch file
18. Cmd + Shift + A – search for action
19. Shift + Cmd + F12 – hide all the window and leave editor only
20. Shift + Cmd + Right/Left arrow (while eg. in Project window) resizes the windows
21. Alt + Up arrow Select code (Alt + Down arrow shrinks selection)
22. Cmd + Shift + Up/Down arrows Move code around (single line or selection)
23. Cmd + D duplicate (line or the whole selection)
24. Shift + Cmd + V = clipboard history
25. Cmd + Backspace – delete the line
26. Alt + Shift + Click(s) – place multiple cursors
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
28. Shift + F6 Rename
29. Ctrl + Alt + I – correct indentation (on selection)
30. Alt + Cmd + L – reformat entire file
There is an action ‘Code cleanup…’ where you can even cleanup entire project
31. Adjust code style with Selection + Alt + Enter (now you can check specific settings)
32. Alt + F1 – switch between views (or go to project view with the currently opened file)
33. Highlight usages of the selected symbol -> Shift + Cmd + F7
34. Alt + F7 show usages
35. Toggle bookmark – F3
Show Bookmarks – Cmd + F3 (you can delete the bookmark from here with backspace)
36. Go to line Cmd + L
37. Cmd + / – write comment ‘//’ and Shift + Cmd + / write comment ‘/* */’
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)
40. Smart completion Ctrl + Shift + Space (whereas Ctrl + Space is normal completion)
41. Cmd + P – get parameter info
42. Hippie completion – Alt + / (type one letter and then hit the key combination)
43. Live Templates -> Cmd + J, type a shortcut and then select (hit enter)
44. Surround Templates -> Cmd + Alt + T
45. Shift + Cmd + Enter – adds semicolon at the end of the line (only if there is no semicolon already)
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/
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)
48. Cmd + B Navigate to declaration
49. Cmd + U Navigate to super-method
50. Alt + Cmd + B shows implementations
51. Ctrl + H – opens type hierarchy window
52. Cmd + Shift + H – opens hierarchy on for a method
53. Cmd + F12 while in editor gives you a file structure (same as Cmd + 7)
54. Switch off navigation bar and invoke it if needed with Cmd + Up arrow
55. Hint – Check out Structural Search action
56. Hint – Check out Analyze menu -> Analyze code to/from here
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
59. Cmd + K commit your changes
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
61. Hint – Evaluate expression in evaluate code window (while in debugger mode) works with Java 8 Lambdas too
62. Ctrl + T brings refactor menu
63. Alt + F12 opens up a terminal
64. Testing Restful web service with IntelliJ Idea build in REST Client (type in Cmd + Shift + A)
65. Ctrl + V – shows menu for version control operations
66. Ctrl + ` – quick change basic settings
67. Hint – Menu Help – you can get keyboard map pdf for reference or Menu Help – productivity guide
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/
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!
This is so much of information. I find it hard to digest it. Anyway, thanks for sharing.
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.