Show Menu
Cheatography

My Emacs Cheat Sheet Keyboard Shortcuts (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Basic

C-x C-c
Quit Emacs
C-g
Abort
C-x C-f
Find a file
C-x C-s
Save the file
C-x s
Save some buffers
C-x C-b
List buffers
<ES­C><­ESC­><E­SC>
All-pu­rpose get out

Movement

C-f
Forward one character
C-b
Back one character
C-n
Next line
C-p
Previous line
C-a
Beginning of line
C-e
End of line
M-f
Forward one word
M-b
Back one word
M-e
Next sentence
M-a
Previous sentence
M-v
Previous screen
C-v
Next screen
M-<
Beginning of buffer
M->
End of buffer
M-g g
Jump to specified line
C-l
Redisplay the test around the cursor

Window

C-x k
To close current buffer
C-x 0
To close current window
C-x 1
Remove other windows
C-x 2
New window below
C-x 3
New window on the right
C-x 4 C-f
Find file in other window
C-x o
moves to the other window
C-M-v
Scroll the bottom window
M-x make-frame : open a new frame
M-x delete­-frame : removes the selected frame.
 

Repeating

C-u 8 C-f
Move forward 8 character
M-8 C-f
Move forward 8 character
C-u 8 C-v
Scrolls by 8 lines, not screenful
C-u 8 *
insert * 8 times
Most Emacs commands accept a numeric argument, The way you give a command a repeat count is by typing C-u and then the digits before you type the command. Altern­ative: type the digits while holding down the META/CTL key

Editing

C-<­SPC>
Start selecting text
C-d
Delete the next char
M-DEL
Kill the word before the cursor
M-d
Kill the next word after the cursor
C-k
Kill to end of line
M-k
Kill to the end of the sentence
C-w
Cut selection
M-w
Copy selection
C-/
Undo, C-_ \ C-x u do the same
C-y
Yank
M-y
Yank pop
M-u
End of word to uppercase
M-l
End of word to lowercase

Auto-F­ill­-Mode

M-x auto-f­ill­-mode
toggles the mode
C-x f
Set the auto fill width
M-q
Re-fill the paragraph

Searching

C-s
Increm­ental search
C-r
Reverse search
<DE­L>
Back / remove characters
M-%
query before replacing string
C-M-%
query before replacing regexp

Mark ring

C-<­SPC> C-<­SPC>
Set the mark
C-u C-<­SPC>
Pop the mark point
 

Help

C-h t
Open the tutorial
C-h v
Help for variable
C-h f
Help for function
C-h k
Help for shortcuts
C-h r
Help menu
C-h i
Read included Manuals
C-h b
Display all key bindings

Sr-spe­ed-bar

M-1
Toggle the sr-spe­ed-bar
U to go up parent directory.
n or p moves to next or previous node.
M-n or M-p moves to next or previous node at the current level.
b switches to buffer list.
f switches back to file list.

Tuareg Mode

C-c C-c
Compile
C-c C-e
Eval phrase
C-x C-e
Eval phrase
C-M-X
Eval phrase
C-c C-r
Eval region
C-c C-b
Eval buffer
M-q
indent phrase
C-c C-s
tuareg­-ru­n-caml
C-c C-k
tuareg­-ki­ll-caml
C-c C-a
switch between ml/mli
M-n/p
switch last repl input
M-x tuareg­-mode: Turn on Tuareg major mode
M-x run-ocaml: Start the OCaml REPL
S-<­RET­>: Evaluate a phrase
M-x ocamldebug FILE: Run the Ocaml debugger

Merlin Mode

C-c C-l
Locate definition
C-c C-SPC
Go back
C-c C-n
merlin­-ph­ras­e-next
C-c C-p
merlin­-ph­ras­e-prev

Undo Tree

M-_
Redo
C-x u
undo-t­ree­-vi­sualize