Red Green Repeat Adventures of a Spec Driven Junkie

Extra Shortcuts in macOS

If you are using macOS (the operating system formerly known as Mac OS X) there are shortcut keys that can improve text editing in any app, like the Notes app, Email app, or any app in a web browser, like Gmail.

All these shortcuts come for free in macOS. Just doing one small change to your keyboard configuration will make accessing them easier: make Caps Lock key an extra Control key.

First step: change caps lock to control

I find life is better with an additional control key right next to the A key on home row.

In macOS, to change Caps Lock into Control:

  1. open System Preferences
  2. open Keyboard
  3. click the Modifier Keys button
  4. on the drop down menu next to ‘Caps Lock’, select: Control

Additional info.

How to Access Extra Shortcuts

All extra shortcuts are by holding the control button down and pressing an additional key (in bold). It is the same pressing as command-f (⌘-f) is usually the shortcut to find text in an app.

The control-__f__ is to hold down the control key and pressing the f key.

List of additional shortcuts

This is the list of shortcuts grouped by functionality: navigation, cut/paste, delete, and miscallaneous.

These are additional keys to move the text cursor around:

  • control-__f__ - move forward one character
  • control-__b__ - move backward one character

  • control-__a__ - move to beginning of line
  • control-__e__ - move to end of line

  • control-__n__ - move to next line
  • control-__p__ - move to previous line

  • control-__v__ - move down a page

Cut & Paste keys

  • control-__k__ - cut text to the end of the line
  • control-__y__ - paste text that was cut by control-k

Deleting characters

  • control-__h__ - remove character behind cursor
  • control-__d__ - remove character ahead of cursor

Miscallaneous

  • control-__t__ - transpose two characters between the cursor
  • control-__o__ - insert a new line (same as pressing return)

Practice all these combinations in the Notepad app. It’s a great way to get used to these new shortcuts.

A Note about Cut and Paste

The interesting part about text cut by control-k and command-x:

  • the text cut by control-k can only be pasted by control-y
  • the text cut by command-x can only by pasted by command-v

This means one can cut two different pieces of texts at the same time:

  • once using command-x and
  • a second time using control-k)

To paste them using two different commands:

  • command-v for the text cut by command-x
  • control-y for the text cut by control-k

The best thing about all of these extra shortcuts? They are free! There are no need for any extra software or system configurations.

Where did these come from?

I’m not entirely sure where these shortcut keys came from, but my best guess: NeXTSTEP.

MacOS uses the command key(⌘) instead of the control key for its modifier key for shortcuts like cut/paste (command-x, command-v.)

When NeXTSTEP was developed, it was on PC hardware, which used control key instead. As MacOS and NeXTSTEP was integrated into Mac OS X, the functionality between NeXTSTEP and MacOS operating systems overlapped , but not in modifier keys. Since both can live in Mac OS X, my guess is the programmers decided to keep them instead. So, now there are extra editing shortcuts!

To me, this is one of the best kept secrets of macOS!

“Wait, these look familiar…”

Any programmer that uses Emacs text editor will recognize many of these shortcuts. Most of them are the same in Emacs!

In summary

There are some extra shortcuts for macOS to work with text. I love that these keys can be used without moving one’s hands from home row Additionally, there’s an extra cut & paste buffer so two different things can be cut and pasted at once.

Go forth and edit better in macOS!