UP | HOME

Emacs

Table of Contents

1 Emacs基本使用

1.1 Basic Movement

Action KEY
Next Screen C-v
Previous Screen M-v
Next Line C-n
Previous Line C-p
Backward C-b
Forward C-f
Forward Next Word M-f
Backward Previous Word M-b
Beginning of a line C-a
End of a line C-e
Beginning of a sentence M-a
End of a sentence M-e
Beginning of the whole text M-<
End of the whole text M->
Give commands numeric argument C-u(eg: C-u 8 C-f)
Jump to specified line M-g g

1.2 Insert and Delete Option

Action KEY
Delete the character before the cursor < DEL >
Delete next character C-d
Kill the word before the cursor M-< DEL >
Kill the word after cursor M-d
Kill from the cursor to end of line C-k
Kill to the end of the current sentence M-k
Select text and Kill them C-<SPC> <Move> C-w
Reinserting killed text(called “yanking” C-y
Yank the privious killed text M-y

Note: single C-k kill the contents of the line, and a second C-k kills the line itself. While numeric argument directly kill the content and the line.

1.3 UNDO

Key: C-/ or C-_ or C-x u

1.4 Files

Action KEY
Find a file or Create the file C-x C-f
Cancel the minibuffer C-g
Save the file C-x C-s
Quit Emacs C-x C-c

1.5 Buffers

Action KEY
List Buffers C-x C-b
Switch to Buffer C-x b
Save some buffers C-x s

1.6 Extending the command set

  • C-x Character eXtend. Followed by one character.
  • M-x Named command eXtend. Followed by a long name.
Action KEY
Replace String M-x replace-string (type “repl s<TAB>”)

1.7 Auto Save

Emacs periodically writes an “auto save” file for each file that you are editing. The auto save file name has a # at the beginning and the end.

  • M-x recover-file <Return> to recover the auto-save data

1.8 Searching

  • C-s <String> start searching
  • C-s go to the next matched string while C-r go to the privious matched string

1.9 Multiple Windows/Frame

  • C-x 2 splits the screen vertically into two windows while C-x 3 splits horizontally
  • C-M-v to scroll the bottom window
  • C-x o to switch the window

  • M-x make-frame <Return>
  • M-x delete-frame <Return>

1.10 Help

  • C-h c <Command> very brief documentation
  • C-h k <Command> detailed documentation in another window
  • C-h f Describe a function
  • C-h a Type in a keyword and Emacs will list all the commands whose names contain that keyword
  • C-h t Open the tutorial
  • C-h r Read the Emacs Manual

Author: Jonathan

Created: 2017-02-22 周三 10:37

Emacs 24.3.50.3 (Org mode 8.0.3)

Validate