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.
- 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 git 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.
- 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.
- 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).
- 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
- Cmd-, Preferences
- Cmd-` Switch between projects
- Shift-Cmd-A Show shortcuts; this is a useful way to navigate to any IntelliJ command