IDE

17 IntelliJ IDEA/Android Studio shortcuts and features for a faster development cycle

A list of IDE shortcuts and features that I use on an almost daily basis

This is a list of my most used IDE features during Android and Front-end development, the shortcuts performed in this article are for IntelliJ 2020.2.4. The shortcuts may differ in other versions but should be applicable in other JetBrains products. Intellij provides a default keymap with a list of popular shortcuts (Beware that some entries might be wrong).

Table of contents

  1. Add selection to the next occurrence (Alt + J / ⌃ + G)
  2. Line duplication (Ctrl + D / ⌘ + D)
  3. Extend selection (Ctrl + W / ⌥ + ↑)
  4. Refactor this (Ctrl + Alt + Shift + T / ⌃ + T)
  5. Search everywhere (Double Shift / Double ⇧) and Find in path (Ctrl + Shift + F / ⇧ + ⌘ + F)
  6. Show context actions (Alt + Enter / ⌥ + Enter)
  7. Add or Remove Caret (Alt + Shift + Button 1 Click / ⌥ + ⇧ + ⌘ + Button 1 Click) or Clone caret above/below (Double Ctrl + Up/Down / Double ⌥ + Up/Down)
  8. Paste from history (Ctrl + Shift + V / ⇧ + ⌘ + V)
  9. Comment out (Ctrl + / / ⌘ + /)
  10. Create new test or Navigate between test and source code (Ctrl + Shift + T / ⇧ + ⌘ + T)
  11. Move statement up/down (Ctrl + Shift + Up/Down / ⇧ + ⌘ + Up/Down)
  12. Recent files (Ctrl + E / ⌘ + E) and Recent locations (Crl + Shift + E / ⇧ + ⌘ + E)
  13. Go to Next/Previous Method (Alt + Up/Down / ⌃ + Up/Down)
  14. Git / VCS
  15. Local history
  16. Splitters
  17. Go to declaration (Ctrl + B / ⌘ + B) and Go to implementation (Ctrl + Alt + B / ⌘ + ⌥ + B)

1. Add selection to the next occurrence (Alt + J / ⌃ + G)

Reverse: Unselect occurrence (Alt + Shift + J / ⌃ + ⇧ + G)

Quickly make properties private
Create non-mutable properties based on mutable ones

Additional shortcuts used:

2. Line duplication (Ctrl + D / ⌘ + D)

Creating class properties
Create non-mutable properties based on mutable ones

Additional shortcuts used:

3. Extend selection (Ctrl + W / ⌥ + ↑)

Reverse: Shrink selection (Ctrl + Shift + W / ⌥ + ↓)

Create a variable from nested inline (There is a better way, see the Refactor this section)
Create non-mutable properties based on mutable ones

Additional shortcuts used:

4. Refactor this (Ctrl + Alt + Shift + T / ⌃ + T)

This is a powerful feature for refactoring and cleaning up code, remembering only the menu shortcut is more than enough. It pays off to get familiar with the provided options.

Refactor this context menu
Refactor this menu (Ctrl + Alt + Shift + T / ⌃ + T) ‌‌ 0 - 9 can be used to quickly access some options.
Rename this action
Rename (Shift + F6 / ⇧ + F6)
Change signature pop up
Change signature (Ctrl + F6 / ⌘ + F6) is used for changing and adding arguments
Extract variable (Ctrl + Alt + V / ⌘ + ⌥ + V)
Extract (Ctrl + Alt + M / ⌘ + ⌥ + M) and Inline function (Ctrl + Alt + N / ⌘ + ⌥ + N)

5. Search everywhere (Double Shift / Double ⇧) and Find in path (Ctrl + Shift + F / ⇧ + ⌘ + F)

Search everywhere window
Search everywhere (Double Shift / Double ⇧) I use it for finding files based on their name using CamelHumps. For IDE actions I use Find action (Ctrl + Shift + A / ⇧ + ⌘ + A)
Find in path window
Find in path (Ctrl + Shift + F / ⇧ + ⌘ + F) based on file content

6. Show context actions (Alt + Enter / ⌥ + Enter)

Prettify function call (Put arguments on separate lines and Add names to call arguments)
Prettify if return; invert and replace if
Create system under test property

7. Add or Remove Caret (Alt + Shift + Button 1 Click / ⌥ + ⇧ + ⌘ + Button 1 Click) or Clone caret above/below (Double Ctrl + Up/Down / Double ⌥ + Up/Down)

Quickly make properties private (Add or Remove Caret)
Create multiple carets using the keyboard (Clone caret above/below)
Add multiple carets on double Ctrl option in the Find action window
Depending on the IDE settings, this might have to be enabled

Additional shortcuts used:

8. Paste from history (Ctrl + Shift + V / ⇧ + ⌘ + V)

Paste from history window
Every copied/cut text in the IDE lands here

9. Comment out (Ctrl + / or ⌘ + /)

Comment out after extending

Additional shortcuts used:

10. Create new test or Navigate between test and source code (Ctrl + Shift + T / ⇧ + ⌘ + T)

Creating a new test for the current class

11. Move statement up/down (Ctrl + Shift + Up/Down / ⇧ + ⌘ + Up/Down)

Move loop and if

12. Recent files (Ctrl + E / ⌘ + E) and Recent locations (Ctrl + Shift + E / ⇧ + ⌘ + E)

Recently opened files window
Recently opened files along with some other shortcuts
Recent locations window
Recent locations where the caret was

13. Go to Next/Previous Method (Alt + Up/Down / ⌃ + Up/Down)

Navigate between functions and properties

14. Git / VCS

Editor gutter git changes preview
Editor gutter changes (A good preview of what changed in the staging area)
Git window at the bottom of the IDE
Git tool window (Overview of all the files and managing Changelists)
Commit window
Commit window (Quick diff before committing)

If you're interested about improving your git workflow, checkout my other article

My Git Workflow for IntelliJ and The Command Line
A short list of my most used Git commands and IDE functionalities like Changelist, Interactive Rebase, Navigating to the previous branch

15. Local history

Local history is for those of us who like to Undo (Ctrl + Z) a lot and then accidentally type something thus breaking the Redo (Ctrl + Shift + Z) functionality.

Local history window
Local history window with timestamps and diffs
Local history context menu in the editor
It is also possible to view history only for a selected portion of the code

16. Splitters

I often use splitters when writing code using TDD, creating them with the Search everywhere or Find Action functions

Spliter actions in the Find actions window
Actions for creating the splitter
Screenshot of side by side test and system under test
Test class side by side with the system under test

To navigate between the splitters I've assigned these shortcuts:

  • Goto Next Splitter - Ctrl + Shift + ] or ⌘ + ]
  • Goto Previous Splitter - Ctrl + Shift + [ or ⌘ + [

17. Go to declaration (Ctrl + B / ⌘ + B) and Go to implementation (Ctrl + Alt + B / ⌘ + ⌥ + B)

Go to declaration shortcut does the same thing as Ctrl + Button 1 Click / ⌘ + Button 1 Click

Go to implementation (Ctrl + Alt + B / ⌘ + ⌥ + B) when there are more than one implementation

Course

If you'd like to improve your IDE workflow, or learn about more outside-coding processes, checkout the Android Next Level course which I'm a co-author of.

Android Next Level
A course about processes outside of coding like: CI/CD, scaling your project, good git hygiene or how to cooperate with your teammates
You've successfully subscribed to AKJAW
Great! Now you have full access to all members content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.