Skip to content

Emacs Keyboard Shortcuts

Note on Keys

Cat Keys Descr
Modifier C Ctrl
Modifier M 'Meta' (ESC, Alt on win, Cmd on mac)
Modifier C-x Character eXtend
Modifier M-x Named commad eXtend

Gen Emacs Shortcuts

Cat Keys Descr
Line C-S-Backspace kill-whole-line
Gen C-x h then M-x write-region "Save As" new file... Select the entire buffer with C-x h, then use M-x write-region
Gen C-h f Describe function (is this similar to M-x ??)
Gen M-. Find definitions of (go to the function definition)

macOS / OS X Shortcuts

Note re Meta key:

"On osx I have my left command key mapped to meta and my left alt key mapped as command, it's a super easy fix."

Link re quote above

Commands (Generic)

Cat Keys Descr
Gen C-x C-c Quit
Gen C-g cancel/stop command
Gen <Esc> <Esc> <Esc> All-purpose 'get out' command (e.g. to close mini-buffer)
Gen C-u specify the number of times that the next command will run
Gen C-/ undo -> alternatives C-_ and C-x u

Copy-Paste etc

Cat Keys Descr
Gen C-<SPC> set mark point
Gen M-<DEL> Kill the word immediately before the cursor
Gen M-d Kill the next word after the cursor
Gen C-k Kill from the cursor position to end of line
Gen M-k Kill to the end of the current sentence
Gen M-w 'copy text'
Gen C-w 'cut text'
Gen C-y 'yank' (paste) text
Gen M-y replace yanked text with previously copied/killed test

Dired Shortcuts

Cat Keys Descr
Dired C-x C-q dired toggle read-only
Dired C-c C-c dired commit changes (e.g. after renaming files)
Wdired C-x C-q change to writeable dired (he modeline for the dired buffer will say Editable)

Org Mode Shortcuts

Cat Keys Descr
indent M-→ add indent
indent M-← decrease indent
indent M-Enter / M-Ret add note/line at same indentation level
indent M-Enter / M-Ret at beg of line: change text line to heading
indent S-arrows "depending on content (e.g. if there are bullets or not)
indent S-arrows un/mark TODO/DONE/etc
indent S-arrows cycle through showing bullets/numbers"
indent C-c * org-toggle-heading (change current text line to a heading)
indent Tab shows/hides the contents of a header (displays "..." when hidden)
indent S-Tab cycle through indentation mode (across all doc)
tasks [ ] line with a checkbox (at the start of the line)
tasks C-c C-c inside a checkbox -> (un)mark checkbox
tasks C-c C-c in a "normal" line: add tag
tasks [/] [%] at top of list with checkboxes sublist -> C-c C-c on this updates progress
agenda C-c [ Agenda view
agenda M-x org-agenda
agenda C-c C-d deadlines
links C-c C-o open link (default opens in new buffer & splits window)
subtree C-c C-w refile subtree (move subtree to another tree) SO Link
focus C-x n s org-narrow-to-subtree : Narrow buffer to current subtree orgmode.org link
focus C-x n b org-narrow-to-block : Narrow buffer to current block
focus C-x n w widen : Widen buffer to remove narrowing
info C-u C-x = (run the command what-cursor-position with a prefix argument) to show information about the character under the cursor, including the face which is being used for it

Language Syntax Highlighting

Cat Keys Descr
Dev M-x shell-script-mode syntax highlighting for bash/sh

Moving Around

Cat Keys Descr
Scroll M-x scroll-lock-mode scroll with cursor
Scroll C-M-v scroll the other 'window'
Scroll C-v scroll down one screen
Scroll M-v scroll up one screen
Gen C-l locate around cursor (3-way toggle)
Move C-p move to previous line
Move C-n move to next line
Move C-b move backward one character
Move C-f move forward one character
Move M-b move backward one word
Move M-f move forward one word
Move C-a move to beginning of the line
Move C-e move to end of the line
Move M-a move to beginning of the sentence
Move M-e move to end of the sentence
Move M-< move to beginning of text
Move M-> move to end of text
Move M-} move one paragraph down
Move M-{ move one paragraph up
Move C-M-f Movement by s-expression forward
Move C-M-b Movement by s-expression backward
Move C-M-d Movement into list down
Move C-M-u Movement into list up

Frames, Windows, Buffers

Cat Keys Descr
Buffer C-x right and C-x left cycle through buffers
Window C-x 1 one window (i.e. kill all other windows)
Window C-x 2 split the screen in two windows horizontally
Window C-x 3 split the screen in two windows vertically
Files C-x 4 C-f find file and open it in another window (i.e split screen)
Files C-x C-f Find file (i.e. open file), also create file, or switch to another open file
Files C-x C-s Save file
Files C-x s Save some files/buffers
Buffer C-x C-b List buffers
Buffer C-x b Switch to buffer (by name) (tab to see list of buffers)
Buffer C-x k Kill current buffer
Window C-x o Move to other window
Frame C-x 5 2 open a new frame (what other applications call 'windows')
Frame C-x 5 0 close current frame (same can be achieved by clicking on the 'X' or red button in window)

IBuffer Commands

Cat Keys Descr
Gen m Mark
Gen u Unmark
Gen *u* Mark unsaved
Gen S Save marked buffers
Gen D Close marked buffers
Gen * u S D This key sequence marks, saves and closes unsaved buffers

Help

Cat Keys Descr
Help C-h k C-f display help, k for key, and press key sequence (in the e.g. C-f)
Help C-h <something> get help on <something> --> if you're really lost, type C-h ?
Help C-h c C-k gives a short description of the C-k command
Help C-h i go to 'Info' the emacs manual

More notes:

  • Macros:
    For those unfamiliar with the concept, (bindings may differ by build) press F3 and emacs will keep track of every key and command you execute until you press F4. You can then re-execute the entire chain of keystrokes simply by hitting F4 as many times as necessary.