Chapter 1 - Basics
In this section, we will cover the basics of IntelliJ IDEA hotkeys, including general purpose commands such as copying and pasting, as well as using built-in IDE helper functionalities. By mastering these fundamental shortcuts, you will be able to perform common tasks more efficiently, allowing you to focus on your work and become more productive.
We recommend that you follow along with each exercise in this section to reinforce your understanding of the hotkeys and improve your muscle memory. Whether you are a seasoned developer or just starting with IntelliJ IDEA, this tutorial series will help you become more proficient and productive. So let’s get to it!
⌘ + c, ⌘ + v
To copy text on a Mac, select the text you want to copy using your mouse or keyboard, then press ⌘ + C. To paste the copied text, move your cursor to the desired location and press ⌘ + V.
In this exercise, we will create a new constructor for Chapter1
without the number parameter, and initialize the number field to the default value
of 0
. Copy the existing Chapter1
constructor by selecting the text using your mouse, then press ctrl + C. Move your cursor to
a new line below the constructor, then press ⌘ + V to paste the copied text. Remove the number parameter from the newly
created constructor, and initialize the number field to 0
.
Keep your hands on your keyboard
Do the same exercise, but ONLY use your keyboard to select text.
How to look up any actions’ shortcut ⌘+shift+a, double shift
Repeat the previous exercise, but instead of using ⌘ + C / ⌘ +
V, use ⌘ + shift + a to open the “Find Action” dialog. Type in the name of the action you want to perform, and IntelliJ IDEA will show you the shortcut associated with that action. Alternatively, you can double-tab the shift key to open the quick action menu and search for the
action you want to perform. Use this method to look up the copy
and paste
actions, so you get a feel for using the dialog.
IntelliJ’s Productivity Guide
Open IntelliJ’s Productivity Guide using these key combinations: First press ⌃ + F2 to focus on the taskbar, then use the arrow keys to navigate to the Help menu, then press down to expand the menu itself, then press enter to select My Productivity.
bonus: Try opening the Productivity Guide using ⌘ + shift + a, then type in “Productivity Guide” in the search bar.
Indenting, formatting with tab
, ⌃ + ⌥ + l
Open Fugly.java
, use selection and indent the test builder patterns properly.
For this exercise, you can use shift and your arrow keys to select lines.
Use ⇥ to indent them manually, or use ⌃ + ⌥ + l
to automatically format the selected
lines.
Hint: When manually indenting, first use shift + ⇥ to unindent everything until the entire selection is against the left side, then ⇥ the entire selection into its first indentation, decrease your selection and ⇥ that into its second indentation. Rinse and repeat.
Auto-indent with ⌃ + ⌥ + l
You can use this combination on specific lines, as well on entire files.
Open FuglyToo.java, select a couple of lines starting with the .withFace(face()
line and press ⌃ + ⌥ + l.
Now empty your selection (select nothing), and press ⌃ + ⌥ + l again.
Undo, Redo ctrl + z
The default undo
and redo
keyboard shortcuts on MacOS work the same over most applications. The weird behavior described in the windows section is
not relevant for Mac users. Use ⌘ + z to undo, and ⌘ + shift + z to redo.