(Emacs) Keyboard Shortcuts for Editing Text Fields in OS X

July 17, 2015

As is widely known, OS X has a collection of keyboard shortcuts involving the arrow keys for editing most text fields including web forms, input boxes, plain text documents, and so on. For example, ⌘← moves the cursor to the beginning of the current line.

Although they are hidden in plain sight, it seems less widely known that OS X also natively supports certain Emacs keyboard shortcuts in those same text areas. For example, to move to the beginning or end of the current line you can press ⌃A or ⌃E. To delete everything on the current line after the cursor use ⌃K. To transpose the characters on the left and right of the cursor, press ⌃T. To recenter the viewport on the current line, press ⌃L. Shortcuts like these can be faster than using ones involving the arrow keys, which requires moving ones fingers away from the home row of the keyboard.

The table below compares the Emacs keybindings with the OS X ones (the Emacs-like ones and more standard ones). For OS X shortcuts we use the usual symbols for the Command , Shift , Option , Control , Caps Lock , Delete , and Function Fn keys and write all letter keys in uppercase. Emacs keybindings are expressed in the usual notation for Control C, Meta (Alt) M, Shift S prefixes and the Delete DEL key and we write the letter keys in lowercase.

Emacs and OS X Keyboard Shortcuts Compared
Entity Direction Emacs OS X
Moving the cursor: move the cursor by character, word, line, etc.
char left C-b ⌃B
right C-f ⌃F
word left M-b ⌃⌥B ⌥←
right M-f ⌃⌥F ⌥→
line begin C-a ⌃A ⌘←
end C-e ⌃E ⌘→
up C-p ⌃P
down C-n ⌃N
doc begin M-< ⌘↑
end M-> ⌘↓
Selecting text: extend the selection1 by character, word, paragraph, and line
char left C-b ⌃⇧B ⇧←
right C-f ⌃⇧F ⇧→
word left M-b ⌃⌥⇧B ⌥⇧←
right M-f ⌃⌥⇧F ⌥⇧→
line begin C-a ⌃⇧A ⇧⌘←
end C-e ⌃⇧E ⇧⌘→
up C-p ⌃⇧P ⇧↑
down C-n ⌃⇧N ⇧↓
Deleting text: remove characters, words, and lines
char left C-h, DEL ⌃H
right C-d ⌃D
word left M-DEL ⌥⌫
right M-d Fn+⌥⌫
line backwards C–0 C-k ⌘⌫
forwards C-k ⌃K
Search: find text and move between search results
result first C-s ⌘F
next C-s ⌘G
previous C-r ⇧⌘G
Scrolling: move and recenter the viewport
page up M-v Fn+
down C-v ⌃V Fn+
recenter C-l ⌃L
Miscellaneous: other insertion, editing, and kill ring2 commands
char transpose C-t ⌃T
line insert C-o ⌃O
kill C-w ⌃K
yank C-y ⌃Y

See Also:


  1. To enter transient-mark-mode in Emacs, press C-SPC first.

  2. The kill ring is an Emacs concept, much like the OS X pasteboard (clipboard), but with a history that can be cycled. The OS X kill and yank commands here make use of a kill ring which is separate from the pasteboard and which can contain only a single element (i.e., no history).