Skip to content

Latest commit

 

History

History
119 lines (71 loc) · 4.71 KB

Lesson3_HandyShortcuts.md

File metadata and controls

119 lines (71 loc) · 4.71 KB

Lesson 3: Handy Shortcuts

Keyboard shortcuts will always be faster than using a mouse. Android Studio has too many shortcuts to list, and you'll end up memorizing some with repeated use.

Here you'll find a full list of Android Studio/IntelliJ's shortcuts.

Here are some of my most used shortcuts:

⌃ Control + R : Run

Installs and runs the app or test.

⌃ Control + D : Debug

Run with the debugger attached.

⌘ Command + ⇧ Shift + A : Invoke Action

I recommend memorizing this command immediately. It is the shortcut to all shortcuts. If you want to invoke an action (commit, reformat code, etc.) start typing and a list of options will appear. Some options have the keyboard shortcut next to them so you can invoke those commands directly next time.

⇧ Shift ⇧ Shift: Search Everywhere

This command is similar to Invoke Action, but the scope is much wider. In addition to searching for actions, double tapping shift will also search for symbols (class names, variable names, resource names, files).

⌘ Command + O : Open Class / ⌘ Command + ⇧ Shift + O : Open File

Other great shortcuts include ⌘+O, which allows you to open classes, and ⌘+⇧+O, which allows you to open files (including classes). Both of these searches allow for fuzzy search, which means that if your classes are CamelCasedLikeSo, you don’t have to type out an entire word before typing the next word. This allows you to find things much faster than typing out each word at a time. For example, if I was searching for the class CoffeeGrinderImpl, I could search for “CoGrIm” and find exactly what I was looking for.

When searching for classes, you can also append your search with “:line number” to go to a specific line number of that class. Searching for “CoGrIm:42” would take me to the 42nd line of the class CoffeeGrinderImpl.

⌘ Command + 1...N : Toggle Tool Window

There are numbered tool windows throughout Android Studio. Pressing ⌘ + the number next to the tool window will toggle its visibility.

  • ⌘ + 1 : Toggle Project View
  • ⌘ + 6 : Toggle Logcat
  • ⌘ + 9 : Toggle Version Control

⌥ Option + ↑ Up / ↓ Down : Smart Select

This will increasingly or decreasingly select text by scope. For example, if your cursor is in the middle of a variable and you continuously press ⌥ + ↑, you well select the variable, then the line it's on, then the containing for loop, then the method body, then the class. Useful for selecting large blocks of text.

⌘ Command + ⌥ Option + ← Left / → Right : Navigate Back / Forward

Places your cursor at the previous/next place it was in history.

⌃ Control + G / ⌃ Control + ⌘ Command + G : Select Next Occurrence / Select All Occurrences

Progressively places multiple cursors at each occurrence of the current selection. Useful for refactoring.

⌥ Option + ⌘ Command + V : Extract Variable

Extracts the current selection into a new variable.

Learn shortcuts faster : KeyPromoterX Plugin

KeyPromoterX is a plugin used to help you memorize shortcuts faster. Each time you click an action with a shortcut, it will remind you of the shortcut for that action. It will also prompt you to create a shortcut if you click on a shortcut-less action multiple times. More info can be found here. To install, go to Preferences > Plugins > Marketplace > KeyPromoterX

Perform ADB Actions: ADB Idea Plugin

Adds the following ADB commands to Android Studio and Intellij:

  • ADB Uninstall App
  • ADB Kill App
  • ADB Start App
  • ADB Restart App
  • ADB Clear App Data
  • ADB Clear App Data and Restart
  • ADB Revoke Permissions
  • ADB Start App With Debugger
  • ADB Restart App With Debugger

All of these can be invoked by ⌘ + ⇧ + A. To install, go to Preferences > Plugins > Marketplace > ADB Idea

Find and implement code: Exynap Plugin

Exynap is an Android Studio plugin which helps you find and implement the code you require in an instant. You only have to formulate a command and press Enter. Exynap has thousands of smart code solutions! Read more here

To install, go to Preferences > Plugins > Marketplace > Exynap

Add your own!

Finally, if there isn't a keyboard shortcut available for an action you'd like to invoke, create your own by going to Preferences > Keymap and add a shortcut.