Skip to content

Instantly share code, notes, and snippets.

@stkent
Last active August 7, 2024 13:04
Show Gist options
  • Save stkent/349cdda974fdb9697be5 to your computer and use it in GitHub Desktop.
Save stkent/349cdda974fdb9697be5 to your computer and use it in GitHub Desktop.
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

⌘ = Command Key
⌥ = Option Key
⇧ = Shift Key
⌃ = Control Key

Essential Shortcuts:

Learn these shortcuts right away.

Description Shortcut
Display list of available auto-fixes for code warning/error at cursor Option-Enter
Go to the declaration of the variable/method/class at cursor Command-B
Rename all copies of the variable/method/class at cursor Shift-F6
List all usages of the variable/method/class at cursor Command-Option-F7
Generate code (incl. getters, setters, constructors, method overrides) Command-N
Search for and open any file by name (filters as you type) Command-Shift-O
Find text in the current file (Enter = cycle through results, Esc. = cancel) Command-F

Frequently Useful Shortcuts:

Learn these shortcuts once you have the essential shortcuts nailed.

Description Shortcut
View javadoc of symbol at cursor in pop-up F1
View definition of method at cursor in pop-up Command-Y
Skip back/forward through cursor position history Command-[, Command-]
Search for and list any occurrences of text Command-Shift-F
Go to next highlighted error in current file F2
Run Control-R
Comment/Uncomment all selected lines (also works in xml files) Command-/
Show available parameters for current method (must be inside parentheses) Command-P
Find and replace in current file Command-R

Shortcuts For Wizards:

Check these shortcuts out if you are bored. To use 'navigate through open tabs', you will have to change or disable the corresponding Mission Control shortcuts [System Preferences > Keyboard > Keyboard Shortcuts > Mission Control].

Description Shortcut
Go to given line number in current file Command-L
Duplicate current line Command-D
Format code to conform to Android Studio's default style Command-Option-L
List implementations/overrides of class/interface/method at cursor Command-Option-B
Search for and go to any symbol (incl. variables and methods) Command-Option-O
Show class structure in pop-up Command-F12
List recently viewed files in pop-up Command-E
List recently edited files in pop-up Command-Shift-E
View code hierarchy for symbol in pop-up Control-Option-H
Move code block at cursor up/down ⌘-⇧-up arrow, ⌘-⇧-down arrow
Navigate through open tabs ⌃-left arrow, ⌃-right arrow
View full refactor menu Control-T
Collapse all code blocks / Expand all code blocks ⌘⇧+, ⌘⇧-
Insert new line below current cursor position Shift-Enter
Complete statement (add braces, parentheses, semi-colon) Command-Shift-Enter
Toggle scheme Control-`
@stkent
Copy link
Author

stkent commented Feb 27, 2020

Command-up arrow should help (as long as the widget is a leaf) if you mean widgets defined in XML. For non-leaf widgets this doesn't work quite as I would expect.

@Banananabandit
Copy link

Some years have passed since you posted this and this stuff is still super useful! Thank you :)

@stkent
Copy link
Author

stkent commented Sep 24, 2022

@Banananabandit glad it helped you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment