# 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](http://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdf). ### Useful symbols: ⌘ = Command Key ⌥ = Option Key ⇧ = Shift Key ⌃ = Control Key ### Essential Shortcuts: Learn these shortcuts right away. | Description | Shortcut | |:----------------------------------------------------------------------------------------|:--------------------:| | Rename **all** copies of the variable/method/class at cursor | Command-F6 | | List **all** usages of the variable/method/class at cursor | Option-F7 | | Find text in the current file (Enter = cycle through results, Esc. = cancel) | Command-F | | Search for and open any file by name (filters as you type) | Command-Shift-O | | Go to the declaration of the variable/method/class at cursor | Option-B | | Display list of available auto-fixes for code warning/error at cursor | Option-Enter | | Generate code (incl. getters, setters, constructors, method overrides) | Command-N | ### Frequently Useful Shortcuts: Learn these shortcuts once you have the essential shortcuts nailed. | Description | Shortcut | |:----------------------------------------------------------------------------------------|:--------------------:| | Search for and list **any** occurrences of text | Command-Shift-F | | Find and replace in file | Command-R | | Next highlighted error in file | F2 | | Run | Control-R | | Show available parameters for current method (must be inside parentheses) | Command-P | | Comment/Uncomment all selected lines (also works in xml files) | Command-/ | | Format code to conform to Android Studio's default style | Command-Option-L | ### Shortcuts For Wizards: Learn these shortcuts 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 | |:--------------------------------------------------------------------------------|:-------------------------------:| | Surround with a try-catch block | Command-Option-T | | Collapse code block / Expand code block | ⌘+, ⌘- | | Collapse all / Expand all | ⌘⇧+, ⌘⇧- | | Debug | Control-D | | Search for and go to any symbol (incl. variables and methods) | Command-Option-O | | Skip back/forward through cursor position history | ⌘-⌥-left arrow, ⌘-⌥-right arrow | | View code heirarchy for symbol | Control-H | | Insert new line below current cursor position | Shift-Enter | | Move code block at cursor up/down | ⌘-⇧-up arrow, ⌘-⇧-down arrow | | Navigate through open tabs | ⌃-left arrow, ⌃-right arrow |