Skip to content

Instantly share code, notes, and snippets.

@elye
Created March 26, 2020 01:31
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elye/b8d5bcb55ded6220312da3337667ad9f to your computer and use it in GitHub Desktop.
Save elye/b8d5bcb55ded6220312da3337667ad9f to your computer and use it in GitHub Desktop.
Android Studio/Xcode shortcut.
General Navigation
╔══════════════════════════════╦═══════════════════════╦═════════════════════╗
║ Item ║ Xcode ║ Android Studio ║
╠══════════════════════════════╬═══════════════════════╬═════════════════════╣
║ Search within file ║ ⌘ F ║ ⌘ F ║
║ Search Across File ║ ⇧ ⌘ F ║ ⇧ ⌘ F ║
║ Search File ║ ⇧ ⌘ O ║ ⇧ ⇧ ║
║ See previous code ║ ^ ⌘ ⇠ ║ ⌘ [ ║
║ See next code ║ ^ ⌘ ⇢ ║ ⌘ ] ║
║ Find definition ║ ^ ⌘ J ║ ⌘ ⇣ ║
║ Goto file in Project Folder ║ ⇧ ⌘ J ║ ScrollToSource Icon ║
╚══════════════════════════════╩═══════════════════════╩═════════════════════╝
Code Navigation
╔══════════════════════════════╦═══════════════════════╦═════════════════════╗
║ Item ║ Xcode ║ Android Studio ║
╠══════════════════════════════╬═══════════════════════╬═════════════════════╣
║ Move right one word ║ ⌥ ⇢ ║ ⌥ ⇢ ║
║ Move left one word ║ ⌥ ⇠ ║ ⌥ ⇠ ║
║ Move to most right ║ ^ ⇢ ║ ^ ⇢ ║
║ Move to most left ║ ^ ⇠ ║ ^ ⇠ ║
║ Move to top ║ ^ ⇡ ║ Fn ⌘ ⇠ ║
║ Move to most left ║ ^ ⇠ ║ Fn ⌘ ⇠ ║
║ Expand function ║ ⌥ ⌘ ⇢ ║ ⌘ + ║
║ Collapse function ║ ⌥ ⌘ ⇠ ║ ⌘ - ║
║ Expand all functions ║ ⇧ ⌥ ⌘ ⇢ ║ ⇧ ⌘ + ║
║ Collapse all functions ║ ⇧ ⌥ ⌘ ⇠ ║ ⇧ ⌘ - ║
╚══════════════════════════════╩═══════════════════════╩═════════════════════╝
Code Editing
╔══════════════════════════════╦═══════════════════════╦═════════════════════╗
║ Item ║ Xcode ║ Android Studio ║
╠══════════════════════════════╬═══════════════════════╬═════════════════════╣
║ Delete a line ║ ^ A K ║ ⌘ ⌫(delete) ║
║ Duplicate a line ║ -Not available- ║ ⌘ D ║
║ Comment out ║ ⌘ / ║ ⌘ / ║
║ Move code up ║ ⌥ ⌘ [ ║ ⇧ ⌘ ⇡ ║
║ Move code down ║ ⌥ ⌘ ] ║ ⇧ ⌘ ⇣ ║
╚══════════════════════════════╩═══════════════════════╩═════════════════════╝
Compile and run
╔══════════════════════════════╦═══════════════════════╦═════════════════════╗
║ Item ║ Xcode ║ Android Studio ║
╠══════════════════════════════╬═══════════════════════╬═════════════════════╣
║ Just compile/build ║ ⌘ B ║ ⌘ F9 ║
║ Run without debug ║ -Not available- ║ ^ R ║
║ Run and debug ║ ⌘ R ║ ^ D ║
║ Clean Project ║ ⇧ ⌘ K ║ -Not available- ║
║ Run Unit Test ║ ⌘ U ║ ⇧ ⌥ R ║
╚══════════════════════════════╩═══════════════════════╩═════════════════════╝
Debug navigation
╔══════════════════════════════╦═══════════════════════╦═════════════════════╗
║ Item ║ Xcode ║ Android Studio ║
╠══════════════════════════════╬═══════════════════════╬═════════════════════╣
║ Step over ║ F6 ║ F8 ║
║ Step into ║ F7 ║ F7 ║
║ Step out ║ F8 ║ ⇧ F8 ║
║ Resume ║ ^ ⌘ Y ║ F9 or ⌥ ⌘ R ║
║ Find Next Error ║ ⌘ ’ (back ⇧ ⌘ '') ║ F2 (back ⇧ F2) ║
╚══════════════════════════════╩═══════════════════════╩═════════════════════╝
Code change related operations
╔════════════════════════════════════════════════════════════════════════════╗
║ 1. Code error fix ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ ⌥ ↩ : Then pick on the fix you want if there is ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ Click on the Error Message ║
║ ║ Then click on the "FIX" button provided if there is ║
╠═════════════════╩══════════════════════════════════════════════════════════╣
║ 2. Code formating ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ ^ ⌥ O : Removed and sort the imports ║
║ ║ ⌥ ⌘ L : Reformat the code style ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ ^ I : Adjust indentation for the selected line/s ║
║ ║ You could use ⌘ A to select the entire page first ║
╠═════════════════╩══════════════════════════════════════════════════════════╣
║ 3. Code renaming ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ ⇧ F6 : Then type the changed name ║
║ ║ this applies change to entire project ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ ^ ⌘ E : Then type the changed name ║
║ ║ this applies to the current scope of fil ║
╠═════════════════╩══════════════════════════════════════════════════════════╣
║ 4. Other Code refactor ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ ⌘ T : Then select the refactor command you want ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ ^ Click [select Refactor] : ║
║ ║ Then select the refactor command you want ║
╚═════════════════╩══════════════════════════════════════════════════════════╝
Editor related operation
╔════════════════════════════════════════════════════════════════════════════╗
║ 1. Hide or Show Windows to view only Editor View ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ Use ⇧ ⌘ F12 to hide or show all Windows ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ ⌘ 0 : Hide/show the left Panel ║
║ ║ ⌥ ⌘ 0 : Hide/show the right Panel ║
║ ║ ⇧ ⌘ Y : Hide/show the bottom Panel ║
╠═════════════════╩══════════════════════════════════════════════════════════╣
║ 2. Enlarge or shrink editor view ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ Pinch - Unpinch to Zoom In/Out Editor ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ ⌘ + : Zoom In to enlarge Editor ║
║ ║ ⌘ - : Zoom Out to shrink Editor ║
╠═════════════════╩══════════════════════════════════════════════════════════╣
║ 3. Navigate across Windows ║
╠═════════════════╦══════════════════════════════════════════════════════════╣
║ Android Studio ║ ^ ⇥ (tab) or ⇧ ^ ⇥ (tab) to switch window/tab ║
║ ║ (and the short cut 1, 2, 3, D ...) ║
╠═════════════════╬══════════════════════════════════════════════════════════╣
║ Xcode ║ ⌘ 1 to ⌘ 9 : switch on the tab of the left windows ║
║ ║ ⌥ ⌘ 1 to ⌥ ⌘ 6 : switch on the tab of the right windows ║
╚═════════════════╩══════════════════════════════════════════════════════════╝
⇧^A = ADB Command
⇧⌘A = Any Command
Help -> Productivity Guide
@BergQuester
Copy link

Great work!

Any equivalent to the MacOS standard ⌘ E? (That's "Use Selection For Find") I use this all the time in Xcode.

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