Shaun Abram
Technology and Leadership Blog
Keyboard shortcuts in IntelliJ
I attended a talk by Hadi Hariri at JavaOne last week. He introduced a whole bunch of IntelliJ keyboard shortcuts I was not aware of. Very useful talk. I have listed some of the most useful ones below. Or see the official reference card.
Navigation
- Cmd-1: Move focus to the Project window
While there, type any class name (including using Camel Case e.g. HW to find HelloWorld), then hit enter to have it open in the editor. F4 or Escape brings you to the editor.
- Fn-Alt-Left arrow (Alt + ↖); Alt + Home also seems to work): Jump to Navigation Bar. (Wondering where the ↖diagonal key is? See here)
- The Navigation Bar is a quick alternative to the Project view, for navigating to and opening files for editing. Since I do not have a function key on my Kinesis Advantage keyboard, I reprogrammed this to be Cmd ‘ (Command and quote)
- Note that my preference is to hide the Navigation bar (View -> Navigation bar), and just call it on demand via Alt + Home (Alt + ↖ for Mac) shortcut.
- Ctrl-N (or Alt-Insert) can then be used to create a new class.
Since the function key is not available on my Kinesis Advantage keyboard, I have reprogrammed this to be: Cmd ‘ (command plus singleQuote)
- Cmd-E: Show recent files
- Cmd-Shift-E: Show recently edited files
- Cmd-Shift-Backspace jump to the latest edit location
- These are all very useful and even allow you to turn of the use of tabs completely (Preferences -> IDE Settings -> Editor -> Editor Tabs -> Placement -> None).
- If you are using the embedded terminal (very convenient)
- Jump to terminal: use Alt-F12 (I reprogrammed to be Cmd-T)
- Jump back to editor: Shift-Escape (hides terminal). But this can be tricky!
Editing shortcuts
- Cmd-D: duplicate current line
- Cmd-Y: delete current line
- Ctrl+Shift+Up or Ctrl+Shift+Down: Move Statement Up/Move Statement Down. Note that if you place the caret at the method declaration, it will move the whole method for you.
- See more at https://www.jetbrains.com/idea/webhelp/adding-deleting-and-moving-lines.html
- Ctrl-W: select ever expanding blocks of text
- Alt-Backspace, Alt-Delete: delete to word start/end
Misc shortcuts
- Cmd-, Preferences
- Cmd-` Switch between projects
- Shift-Cmd-A Show shortcuts; this is a useful way to navigate to any IntelliJ command
- Hide all Tool Windows (basically, maximize the editor window): Cmd-Shift-F12 (although that didn’t work for me; I set to Alt-M)
Tags: intellij, keyboardshortcuts