Prologue: PSA
The Control key plays a fundamental role in a lot of shortcuts but it resides in a position that requires people to stretch their tendons. Not good if you want to avoid RSI issues! Instead, you can map the Caps Lock to the Control key, which is really straightforward on the Mac (see below).
Keyboard shortcuts are a big part of my workflow since minimizing mouse-keyboard switching saves a lot of time and fatigue. Here's a list of the shortcuts I find the most useful.
Text fields
- Control-F
- Move cursor forward one character
- Control-B
- Move cursor backward one character
- Control-P
- Move cursor up one character
- Control-N
- Move cursor down one character
- Control-A
- Move cursor to beginning of line
- Control-E
- Move cursor to end of line
- Control-K
- Delete entire line after cursor
- Control-O
- Insert new line after cursor
Sublime Text 3
- Command-D
- Selects entire word at cursor. Really useful for quickly selecting and deleting a word. (Keep pressing to expand selection to next occurrence.)
- Command-K [U/L]
- Converts selected text to Upper / Lower case
- Command-T <file name>
- Quickly open a file by name
- Control-1
- Selects the first group. You can also use 2, 3, … if you have more groups
- Control-Tab
- Alternates between last used tab (like a stack)
- Control-G <line number>
- Go to line number. Very useful for navigating to somewhere far away without using the mouse
- Control-Minus
- Jumps back to previous cursor position. Great if used in combination with above. You can use Ctrl-Shift-Minus to jump forward
- Control-T
- If you have multiple selections, this shortcut will “rotate the selection round-robin style. (If you have two selections it swaps them)
- Control-Shift-J
- Reveal current file in sidebar. I remapped this to be the same as the default shortcut combination in Xcode
- Control-R
- Switches to matching header/implementation file. This was a lot easier to press compared to the default Command-Option-Up
Finder
See the Instructions below for setting up these custom shortcuts.
- Command-Shift-1
- Open terminal at selected folder. Unfortunately this requires actually selecting a folder. If anyone knows how to do this without selecting please let me know!
- Command-Shift-2
- Create a ZIP archive of selected files.
Xcode
The first three shortcuts are very useful complements to each other:
- Command-Shift-J
- Show current finder in sidebar
- Command-Shift-C
- Move cursor to console area
- Command-J
- Move cursor to code editor
- Command-Control-R
- Continue running (when stopped at breakpoint)
- Command-Shift-O
- Open Quickly any file. (Vastly improved to add emacs support in Xcode 9!)
Custom shortcuts:
- Option-Shift-S
- Select iPhone SE simulator as destination
- Option-Shift-6
- Select iPhone 6 simulator as destination
- Option-Shift-J
- Select my iPhone as destination
Instructions
Below: Mapping Caps Lock to Control
Below: New terminal at folder (and many other services)
Below: Compress (Archive) files
Do you know some obscure shortcut or have your own favourite? Share it in the comments!
Top comments (4)
The
CapsLock -> Ctrl
remap is also highly effective for Linux users. For Ubuntu, the most straight forward way of doing it was to install Gnome Tweak Tool and tick a checkbox inTyping
->Caps Lock as Ctrl
.⌘ CMD+⇧ SHIFT+. reveals hidden files in Finder and Open/Save dialogs.
Control-R in the terminal
Maybe a more appropriate title is 'Keyboard Shortcuts in Mac'?