Show Menu
Cheatography

Emacs cheat sheet Cheat Sheet by

This is a general perpose Cheet Sheet

Starting emacs

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
C-c
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
M-x DELETE­-WINDOW
To delete current window
M-x DELETE­-OT­HER­-WINDOW
To Delete other window
 

Utility

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

C-M-f
Move forward over a balanced expression
C-M-b
Move backward over a balanced expression
C-M-k
Kill balanced expression forward
C-M-SPC
put the mark at the end of the sexp.
C-M-n
Move forward over a parent­hetical group
C-M-p
Move backward over a parent­hetical group
       
 

Comments

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