Show Menu

Emacs cheat sheet Cheat Sheet by

This is a general perpose Cheet Sheet

Starting emacs

to start emacs.
emacs filename
to start emacs and load a file
emacs -nw filename
to start emacs with no new window (load file)

Search and Replace

Ctrl S patter­ntext
search for patter­ntext; cursor moves as you type. Press [Enter] once at the correct location
Ctrl R patter­ntext Enter
search backwards for patter­ntext; cursor moves as you type.
Ctrl S Enter Enter
search for the next occurrence
Esc % oldstring Enter newstring Enter
Search for oldstring and replace it with newstring. The Y key confirms each replac­ement, N skips it, Q to exit

Working with Term

M-x term
To open a new treminal buffer
This is used to instead of C-x in term mode
C-c b
to Change the buffer
C-c k
to kill the terminal buffer

Working ansi-term

M-x ansi-term
To open ansi term
C-c C-j
To go in line mode and Scroll
C-c C-k
To go back to char mode
Ansi term is same as term, just you can use C-x for commands instead C-c So dont use term :)

Cursor Positi­oning

Ctrl F or ->
forward (right) one character.
Ctrl B or <-
back (left) one character
Ctrl P or ^ (up)
up one character
Ctrl N or v (Down)
down one character
Esc B
left one word
Esc F
right one word
Ctrl A
to beginning of line
Ctrl E
to end of line
Esc <
start of document
Esc >
end of document
Esc V
page up
Ctrl V
page down
Ctrl L
cursor in middle of screen
Ctrl U 20 Ctrl N
advance 20 lines
Ctrl x w
display the line number where the cursor is located
Esc X goto-line Enter 999 Enter
go to line number 999

Split window

C-x 1
Single window
C-x 2
Add one Horizontal Window
C-x 3
Add one vertical window
C-x o
Switch to slipted window
To delete current window
To Delete other window


Ctrl+Space -> Alt+w -> Ctrl+y
Copy paste
Ctrl+Space -> Ctrl+w -> Ctrl+y
Cut Paste
Ctrl X Ctrl C
quit emacs
Ctrl G
aborts any command in progress
f2 (Custom)
This will give option to rename a buffer
M-x imenu
To naviagte to functions and variables
M-x speedbar
This also can be used to navigate function & method.

Loading and Saving

Ctrl X Ctrl F filename
create new filename for editing (clears workspace)
Ctrl+X Ctrl+W filename
write (save) as filename
CtrlX -> Ctrl S
resave under the current filename

Matching parant­hesis

Move forward over a balanced expression
Move backward over a balanced expression
Kill balanced expression forward
put the mark at the end of the sexp.
Move forward over a parent­hetical group
Move backward over a parent­hetical group

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Web Programming Cheat Sheet
            Python 3 Cheat Sheet by Finxter