Skip to content

Instantly share code, notes, and snippets.

@jacobvosmaer
Created July 27, 2012 14:22
Show Gist options
  • Save jacobvosmaer/3188296 to your computer and use it in GitHub Desktop.
Save jacobvosmaer/3188296 to your computer and use it in GitHub Desktop.
Terminal touch typing shortcuts in OS X

Terminal touch typing shortcuts in OS X

Remapping CAPS LOCK to Control also has benefits outside of the terminal in OS X (10.7).

Remapping CAPS LOCK and enable the Meta key

OS X's terminal becomes a much happier place if you remap CAPS LOCK to the Control key, and if you enable the Option key. One downside of this, which applies only in Terminal.app, is that you can no longer enter symbols which can only be created using the Option key, such as å∂©∂߃å߃åß∂ƒ´œ¥†¥¢∞¢¢œåƒ√.

Benefits in Terminal.app

Being able to reach the Contol-key with your left pinky finger makes a lot of UNIX keyboard shortcuts more comfortable, for example Control-h for Backspace and Control-j (or Control-m) for Enter/Return. Another favorite is Control-i for Tab; to see more you can check out the documentation of the standard Bash shell (note that the M- prefix used in that document now refers to your Option-key). Having the option key at your disposal makes it possible to delete text in single word rather than single character chunks: M-f to delete a word forward, and M-Backspace to delete a word backwards.

Let it be known however that some command-line programs on OS X use Editline, the BSD version of Readline, which does not support all the shortcuts provided by GNU Readline.

Beyond the Terminal

What I like about these remapped keys and 'UNIX shortcuts' is that they are very easy to reach if you have your fingers on the home row. Surprisingly, some of the 'UNIX shortcuts' sometimes also work in other programs. As I type this in a Google Chrome text box, I can use the following shortcuts:

  • C-a and C-e to jump to the start/end of the current line;
  • C-t to do a character swapping dance;
  • C-n and C-p to move the cursor to the next/previous line;
  • C-f and C-b to move the cursor forward/backward;
  • C-d and C-h function as Delete/Backspace;
  • C-k and C-y to kill/yank lines Emacs-style, independently of the system clipboard;
  • C-v as page-down; and
  • C-m as Enter/Return.

Not all of these shortcuts work everywhere; for instance, when typing in Chrome's address bar I cannot use C-m as Enter. Still, these can be quite useful, and easy to reach if your CAPS LOCK is remapped to Control.

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