Keyboard Shortcuts
Tags: workflows
Published: 2017-06-25 13:58:01

---
title: Keyboard Shortcuts
published: true
description: 
tags: Workflows
canonical_url: https://jerryyu.ca/2017/06/24/Keyboard-Shortcuts/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/8jhjt4i6tboj6g4ndg3u.jpg
---


### *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 (<a href="#p28-Instructions">see below</a>).

---



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
<dl class="p28">
  <dt>Control-F</dt>
	  <dd>Move cursor <em>forward</em> one character</dd>
  <dt>Control-B</dt>
	  <dd>Move cursor <em>backward</em> one character</dd>
  <dt>Control-P</dt>
	  <dd>Move cursor <em>up</em> one character</dd>
  <dt>Control-N</dt>
	  <dd>Move cursor <em>down</em> one character</dd>
  <dt>Control-A</dt>
	  <dd>Move cursor to <em>beginning</em> of line</dd>
  <dt>Control-E</dt>
	  <dd>Move cursor to <em>end</em> of line</dd>
  <dt>Control-K</dt>
	  <dd>Delete entire line after cursor</dd>
  <dt>Control-O</dt>
	  <dd>Insert new line after cursor</dd>
</dl>

## Sublime Text 3

<dl class="p28">
  <dt>Command-D</dt>
  <dd>Selects entire word at cursor. Really useful for quickly selecting and deleting a word. (Keep pressing to expand selection to next occurrence.)</dd>

  <dt>Command-K [U/L]</dt>
  <dd>Converts selected text to Upper / Lower case</dd>

  <dt>Command-T &lt;file name&gt;</dt>
  <dd>Quickly open a file by name</dd>

  <dt>Control-1</dt>
  <dd>Selects the first group. You can also use 2, 3, … if you have more groups</dd>

  <dt>Control-Tab</dt>
  <dd>Alternates between last used tab (like a stack)</dd>

  <dt>Control-G &lt;line number&gt;</dt>
  <dd>Go to line number. Very useful for navigating to somewhere far away without using the mouse</dd>

  <dt>Control-Minus</dt>
  <dd>Jumps back to previous cursor position. Great if used in combination with above. You can use <em>Ctrl-Shift-Minus</em> to jump forward</dd>

  <dt>Control-T</dt>
  <dd>If you have multiple selections, this shortcut will “rotate the selection round-robin style. (If you have two selections it swaps them)</dd>

  <dt>Control-Shift-J</dt>
  <dd>Reveal current file in sidebar. I remapped this to be the same as the default shortcut combination in Xcode</dd>

  <dt>Control-R</dt>
  <dd>Switches to matching header/implementation file. This was a lot easier to press compared to the default Command-Option-Up</dd>
</dl>


## Finder
See the <a href="#p28-instructions-terminal">Instructions below</a> for setting up these custom shortcuts.

<dl class="p28">
  <dt>Command-Shift-1</dt>
  <dd>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!</dd>

  <dt>Command-Shift-2</dt>
  <dd>Create a ZIP archive of selected files.</dd>
</dl>


## Xcode
The first three shortcuts are very useful complements to each other:

<dl class="p28">
  <dt>Command-Shift-J</dt>
  <dd>Show current finder in sidebar</dd>

  <dt>Command-Shift-C</dt>
  <dd>Move cursor to console area</dd>

  <dt>Command-J</dt>
  <dd>Move cursor to code editor</dd>

  <dt>Command-Control-R</dt>
  <dd>Continue running (when stopped at breakpoint)</dd>

  <dt>Command-Shift-O</dt>
  <dd>Open Quickly any file. (Vastly improved to add emacs support in Xcode 9!)</dd>
</dl>

Custom shortcuts:

<dl class="p28">
  <dt>Option-Shift-S</dt>
  <dd>Select iPhone SE simulator as destination</dd>

  <dt>Option-Shift-6</dt>
  <dd>Select iPhone 6 simulator as destination</dd>

  <dt>Option-Shift-J</dt>
  <dd>Select my iPhone as destination</dd>
</dl>

<h2 id="p28-Instructions">Instructions</h2>

Below: Mapping Caps Lock to Control
![Image](https://thepracticaldev.s3.amazonaws.com/i/cnkn2gn360lzn2yux4lz.png)

Below: New terminal at folder (and many other services)
![Image](https://thepracticaldev.s3.amazonaws.com/i/ejdmoqxqfnqeyaakwte5.png)

Below: Compress (Archive) files
![Image](https://thepracticaldev.s3.amazonaws.com/i/t9yknqc1oppfb5zi1mf1.png)

---

Do you know some obscure shortcut or have your own favourite? Share it in the comments!