Skip to the content.

Chapter 1 - Basics

Back to outline

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!

Windowsctrl+c, ctrl+v

To copy text, select the text you want to copy using your mouse or keyboard, then press Windowsctrl + C. To paste the copied text, move your cursor to the desired location and press Windowsctrl + 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 Windowsctrl + C. Move your cursor to a new line below the constructor, then press Windowsctrl + 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 Windowsctrl+shift+a, double shift

Repeat the previous exercise, but instead of using Windowsctrl + C / Windowsctrl + V, use Windowsctrl + 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 Windowsalt + h for (H)elp (in the taskbar), then press P to select (P)roductivity Guide.

bonus: Try opening the Productivity Guide using WindowsCtrl + Shift + A, then type in “Productivity Guide” in the search bar.

Indenting, formatting with Windowstab, shift+tab

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 Tab to indent them manually, or use Windowsctrl + alt + l to automatically format the selected lines.

Hint: When manually indenting, first use Windowsshift + Tab to unindent everything until the entire selection is against the left side, then Tab the entire selection into its first indentation, decrease your selection and Tab that into its second indentation. Rinse and repeat.

Auto-indent with Windowsctrl+alt+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 Windowsctrl + alt + l. Now empty your selection (select nothing), and press Windowsctrl + alt + l again.

Undo, Redo Windowsctrl+z and Windowsctrl+shift+z

In most editors, Redo is mapped to Windowsctrl + y. Not so in IntelliJ.
This can lead to hilarious (or super annoying) situations where you’ll lose your undo buffer.

Let’s try it out and see what happens so you’ll remember it better. Open FuglyToo.java once more. Add a comment above the method that reads // this method is fugly. Add a comment on a new line that reads // such fugliness should never be allowed. Press Windowsctrl + z (Undo) and see what happens.

Press it a couple of times.

Now press Windowsctrl + shift + z (Redo) and see what happens. Add these three comments to the file, each starting on a different line:

// herpty
// derpty
// derp

After you’ve typed the last line, press Windowsctrl + z until you only have // herpty left.

As most people will have the reflex to press Windowsctrl + y to Redo their work, let’s see what happens when we do just that. Use Windowsctrl + y, then try Windowsctrl + shift + z to attempt and redo the revert you wish to reapply.

Try Windowsctrl + z and see what that does. Try Windowsctrl + shift + z again now. ` Keep this strange behavior in mind when you work in IntelliJ, or in another editor that doesn’t have Windowsctrl + y for Redo :)


Next Chapter

Back to outline