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-`
@brunogabriel
Copy link

Real nice, thanks.

@amajeedmuazu
Copy link

So how can I insert a for loop (auto complete) by typing 'for' then ...

@huseyinbarin
Copy link

⌃-left arrow, ⌃-right arrow will cause the switching operating system's windows. How can handle with this?

@stkent
Copy link
Author

stkent commented Apr 27, 2017

@mahrezzz I've since switched to a tabless configuration, so I'm not sure any longer. Sorry!

@hendercine
Copy link

hendercine commented Jun 26, 2017

@mahrezzz Command + shift + [ and Command + shift + ] or Navigate-Back and Navigate-Forward will switch between tabs in the editor.

@haxpor
Copy link

haxpor commented Aug 5, 2017

Split vertically, and horizontally are good to have too, but you need to set it manually via Cmd+, to open Preferences. Then click on Keymap. Enter in text field to search for Split horizontally or Split vertically. Add your keymap there.

@Violet-Bora-Lee
Copy link

I've changed OS from Windows to MacOS. Is there anyone who knows same shortcut of alt up(or down) arrow in MacOS?
This shortcut makes u move upper or below methods.

@mehulparmar4ever
Copy link

Good work man.

@aalap03
Copy link

aalap03 commented Jan 23, 2018

I have a weird problem, in my android studio in MAC I am not able to print "|" (OR) symbol, (In both french and english key board), I tried all the pairings with using command, alter and ctrl but doesn't work, thus I have to go to other editor, and type "|" (Using alt + / (key besides 1)) and copy paste in android studio. Any solutions ?

@Lavanyagaur22
Copy link

Lavanyagaur22 commented Jul 14, 2018

Really helpful . Thanks!

@Lavanyagaur22
Copy link

Really helpful . Thanks!

@andriitech
Copy link

andriitech commented Jul 19, 2018

+1

@Melanie918
Copy link

This is very helpful 👍

@Nunens
Copy link

Nunens commented Jan 8, 2019

Thanks, this is really helpful....

@andrewclam1991
Copy link

Thanks man, helps so much for moving from PC to MAC for android dev.

@Letalus
Copy link

Letalus commented Feb 27, 2020

how can i select an entire widget with a shortcut?

@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