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.
- Move cursor forward one character
- Move cursor backward one character
- Move cursor up one character
- Move cursor down one character
- Move cursor to beginning of line
- Move cursor to end of line
- Delete entire line after cursor
- Insert new line after cursor
- 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
- Selects the first group. You can also use 2, 3, … if you have more groups
- 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
- Jumps back to previous cursor position. Great if used in combination with above. You can use Ctrl-Shift-Minus to jump forward
- If you have multiple selections, this shortcut will “rotate the selection round-robin style. (If you have two selections it swaps them)
- Reveal current file in sidebar. I remapped this to be the same as the default shortcut combination in Xcode
- Switches to matching header/implementation file. This was a lot easier to press compared to the default Command-Option-Up
See the Instructions below for setting up these custom shortcuts.
- 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!
- Create a ZIP archive of selected files.
The first three shortcuts are very useful complements to each other:
- Show current finder in sidebar
- Move cursor to console area
- Move cursor to code editor
- Continue running (when stopped at breakpoint)
- Open Quickly any file. (Vastly improved to add emacs support in Xcode 9!)
- Select iPhone SE simulator as destination
- Select iPhone 6 simulator as destination
- Select my iPhone as destination
Do you know some obscure shortcut or have your own favourite? Share it in the comments!