This following list summarized some common used Emacs commands:
open file/close file
C-x C-w
: save as to a new fileC-x C-s
: save current file
copy and paste
M-w
: copyC-y
: paste
split window
C-l C-l
-->C-x 2
-->C-x o
to switch different windowC-x 1
: close other windows to keep only oneM-x make-frame or M-x delete-frame
: open or delete a new emacs window of a fileC-x 3
: side by side splitting window
delete content and paragraphs
C-d
: delete the next character after the cursorM-d
: delete next wordC-k
: delete to the end of lineM-k:
kill to the end of the current sentence
move to different location
C-f or C-b
: move forward and backward by a characterM-f or M-b
: move forward and backward by a wordC-n or C-p
: move to next or previous lineC-a or C-e
: move to the beginning or end of the lineM-a or M-e
: move to the beginning or end of the sentenceM-< or M->
: move the beginning or end of the fileM-g g #:
go to specific line #
type the same words for multiple lines
Add text
Start rectangle mode
C-x SPACE
Move cursor to the previous (
p
) or next (n
) lineC-p
/C-n
Target rectangle area
C-x r t
Type text followed by
RET
to have text in selected lines
Remove text
Start rectangle mode
C-x SPACE
Move cursor to the previous (
p
) or next (n
) lineC-p
/C-n
Move cursor forward (
f
) or backward (b
) by character (C
) or line (M
).M-f
/M-b
To remove text:
BACKSPACE
search
C-s
: search forwardC-r
: search backward- keep typing the ctrl-s or ctrl-r to move the cursor. Press enter to end the search
move the cursor location
C-u 8 C-f:
move forward by 8 characters
create new file
C-x C-f
: new file
undo and redo
C-x u
or C-_: undo
select all
C-x h
exit commands
Esc-Esc-Esc
: 3 times Esc to exit commands
quit emacs
C-x C-c
: quit
Help
C-H ?
: display the help manual of emacs
Mark a selection area
- C-space, C-@: to mark the beginning and end of selection. You can cut the selection area by C-w
replace with search
Alt+Shift+5: start the process of replace command
two queries will pop up: one to ask for the word to be replaced and the other for word to replace with
after that, the third query to ask you to type one of the following commands: