Skip to content

marcpaq/hecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Hyperlinked Emacs Cheat Sheet

Survival tips

Stuck? Press C-g or press ESC ESC ESC.

Minibuffer: fixed, compact, non-modal(-ish) dialog for status messages, command history, and interacting with commands.

Mode: Alters editor behaviour and appearance automatically to the type of text you edit. You learn one editing feature and Emacs adapts the feature to the problem. Example: Pressing TAB at the beginning of a line in fundamental-mode inserts a tab character while TAB in python-mode aligns indentation of the statement.

Touch-typing: if you don't already, learn!

Keyboard

Name Key
C- Press and hold Control
M- Press and hold Alt
S- Press and hold Shift
BACKSPACE Press and release Backspace
ESC Press and release Escape
DEL Press and release Delete
RET Press and release Enter
SPC Press and release Space
TAB Press and release Tab

Launching, quitting, getting out of trouble

Description Command
Start emacs filename [ filename...]
Kill (aka quit) C-x C-c
Cancel command C-g or ESC-ESC-ESC
Undo C-/

Getting help

Description Command
Emacs tutorial C-h t
Describe keyboard command C-h k keyboardcommand
Describe Emacs Lisp function C-h f functionname
Describe Emacs Lisp variable C-h v variablename
Search functions C-h a
Describe active modes C-h m

Files and buffers

File: text on your computer’s local storage or on the network. Each file has an associated buffer.

Buffer: text in Emacs for you to edit or view. Not every buffer has an associated file or window.

Description Command
Visit (aka open) a file C-x C-f
Save buffer to its file. C-x C-s
Re-visit (aka revert) a file in a buffer C-x C-f M-n RET
Save all modified buffers C-x s
Dired (aka view directory/folder) C-x d
List all buffers C-x C-b
Switch to buffer C-x b

Moving around

Point: aka the insertion point, aka the cursor. Each window has its own point.

Description Command
Forward and backward one character C-f and C-b
Forward and backward one word M-f and M-b
Beginning and end of line C-a and C-e
Forward and backward one sentence M-a and M-e
Up and down one line C-p and C-n
Up and down one paragraph M-{ and M-}
Up and down a screenful of lines M-v and C-v
Beginning and end of buffer M-< and M->

Selecting, deleting, and moving

Region: The text between point and mark, aka selection. The region is only visible when you set mark.

Mark: A secondary cursor at the other end of a region. Each window has its own mark.

Kill ring: A cyclical list of previous kills, aka multiple clipboards.

Killing: Insert the region into the kill ring, either by killing the region (aka cutting) or saving it (aka copying).

Yanking: Insert an item from the kill ring into the buffer.

Description Command
Set mark C-SPC or C-@ or click-drag the left mouse button
Mark whole buffer, aka select all C-x h
Delete character at point C-d or DEL
Delete character before point BACKSPACE
Delete to end of word M-d
Kill to end of line C-k
In an empty line, delete line C-k
Kill region C-w
Save region to kill ring M-w
Insert most recent item in kill ring C-y
Immediately after C-y, replace inserted kill with next item in kill ring M-y

Searching and replacing

Description Command
Search forward for search text C-s search-text
Search backward for search text C-r search-text
Go to next occurrence of search text C-s
Go to previous occurrence of search text C-r
Search and replace M-% search-text RET replace text RET

Windows

Window: panes in a frame. Each window displays its associated buffer, not all buffers have a window.

Frame: contains windows. A frame is what most modern operating systems call a “window”.

Description Command
Split window horizontally C-x 2
Split window vertically C-x 3
Go to next window C-x o (lowercase o)
Delete (aka hide) window C-x 0 (zero)
Delete (aka hide) all other windows except the selected one C-x 1 (one)

Don’t repeat yourself

Description Command
Repeat the last command C-x z
Repeat a command n times C-u n C-u command
Start recording keystrokes F3
While recording, stop recording keystrokes F4
When not recording, replay the last-recorded keystrokes F4
Name the last-recorded keystrokes C-x C-k n macroname
Replay named keystrokes M-x macroname
Save named keystrokes Visit file to save the macro in, M-x insert-kbd-macro RET macroname RET, save the buffer

Customizing and extending

Description Command
Execute a function M-x functionname RET
View, install, and uninstall packages M-x list-packages
Customize settings M-x customize

Have fun

Description Command
Use butterflies to set a bit on your hard drive M-x butterfly
Talk to a therapist M-x doctor

About

Hyperlinked Emacs Cheat Sheet

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published