Quick reference for Emacs common commands

Source: Internet
Author: User
Tags save file

Quick reference for Emacs common commands

Summary of common commands for Emacs from Emacs reference Cards

Note: The keys labeled in the following command, uppercase C for control, usually the CTRL key on the keyboard, and m for meta, usually the ALT key on the keyboard, and s for shift, which is usually the SHIFT key on the keyboard, that is,

C

Control

M

Alt

S

Shift

These three keys in Emacs are usually used as the leading key combination, that is, you may need to hold down the key before executing a command, such as the Search command is c-s, to execute this command first to hold the CTRL key, then press the letter S key, and open the file command is C-x c-f, To open the file you have to press the CTRL key, press X and F (of course, you can also press CTRL and then press the X, release, and then press CTRL and then press f), and some command combination keys and non-combination keys are used, such as saving all the files are c-x s, you need to press CTRL not put down when the X, Then let go of all the keys, and then press S, there are two combinations of keys used together, such as the use of regular expressions for incremental search shortcut keys are c-s-%, which requires you to press CTRL and ALT not release, and then press S.

Activate Emacs

In the context of a graphical interface, you only need to enter Emacs in the terminal to press ENTER or find the icon to activate the Emacs program to open it.

Emacs with a character interface in an environment or pseudo-terminal without a graphical interface can enter EMACS-NW, which is to add a-NW parameter.

Suspend Emacs

C-z

Hangs in the graphical interface is usually the use of the Emacs window to minimize the meaning, and in the character interface is to put Emacs into the background after the back to the terminal, for example, under the Gnu/linux character Terminal Press C-z will return to the shell, using the jobs command to list all of your suspended tasks, With FG, you can return a task that has been suspended for the last time, and FG%num can choose to return to any of the suspended tasks.

Exit Emacs

C-x c-z

If there is no unsaved file, then this command exits the Emacs program, otherwise it will prompt you to save the file.

File

Open File

C-x c-f

Save File

C-x c-s

Save All Files

C-x s

Inserting other files into the current buffer

C-x I

Open another file in the current buffer

C-x c-v

Save As File

C-x c-w

Get help

Open Quick Guide

C-h T

Get key Help

C-h K

Get function Help

C-h F

Open Emacs Help Manual

C-h R

Error recovery

Discard the current command or terminate the operation being performed

C-g

Recover files lost due to system crashes

M-x Recover-file

Undo Last Action

C-x U or c-_

Restore the contents of a buffer

M-x Revert-buffer

Refresh Screen

C-l

Incremental Search

Forward Search

C-s

Reverse Search

C-r

Using regular expressions to search forward

C-m-s

Reverse-search using regular expressions

C-m-r

Select Previous search results

M-p

Select the next search result

M-n

Exit the search and stay in the current search location

Ret

Abort Current Search

C-g

Move

Moving units

Back

Forward

Character

C-b

C-f

Words

M-b

M-f

Yes

C-p

C-n

Start or end of current line

C-a

C-e

Sentence

M-a

M-e

Paragraph

m-{

M-}

Page

C-x [

C-x]

An expression

C-m-b

C-m-f

Function

C-m-a

C-m-e

The beginning or end of a buffer

m-<

M->

Vertical scrolling Screen

C-v

M-v

Horizontal scrolling Screen

C-x <

C-x >

Scrolls the current line to the center of the screen

C-u

C-l

Specify row movement

M-g m-g

Delete

Deleted units

Backwards

Forward

Character

del

c-d

Word

M-del

m-d

Line

M-0 c-k

c-k

Sentence

C-x D EL

m-k

Expression

m--c-m-k

C-m-k

Delete current line

C-s-del

 

Delete area

C-w

 

Copy zone to delete ring

m-w

 

Delete to character

M-z char

 

Pull content back from delete ring

c-y

 

Pull back older content from the delete ring

m-y

 

Note: The Del here may be backspace on your keyboard.

Mark

Set tag

[Email protected]

Jumps at the current cursor position and marker

C-x C-x

Set Word Markers

[Email protected]

Mark Segment

M-h

Markup page

C-x c-p

Tag expression

[Email protected]

Tag function

C-m-h

Mark the entire buffer

C-x h

Query substitution

Interactive substitution

m-%

Using regular expressions

M-x Query-replace-regexp

In Query substitution mode:

Replace the current item and jump to the next item

Spc

Replace current item does not jump

,

Does not replace the current item and jumps to the next item

Del

Replace all remaining query results

!

Back to previous matching results

^

Exit query Substitution

Ret

Enter recursive edit (C-m-c exit)

C-r

Multiple panes

The first explanation is that a frame in Emacs is a window in the value window System, and a pane (window) is a frame

Command description

window pane

Box

Delete all other panes

C-x 1

Vertical split

C-x 2

C-x 5 2

Delete Current Pane

C-x 0

C-x 5 0

Split horizontally

C-x 3

Scroll other panes

C-m-v

Switch to another pane

C-x o

C-x 5 O

Toggle Buffers in other panes

C-x 4 B

C-x 5 B

Display buffers in other panes

C-x 4 C-o

C-x 5 C-o

Open a file in another pane

C-x 4 F

C-x 5 F

Open a file as read-only in another pane

C-x 4 R

C-x 5 R

Open Directory in other panes

C-x 4 D

C-x 5 D

Find labels in other panes

C-x 4.

C-x 5.

pane height increase

C-x ^

window pane width reduction

C-x {

The width of the pane increases

C-x}

Formatting

Indent as you go forward

TAB

Indent area

c-m-/

Indent an expression

C-m-q

Increase Indent

C-x TAB

Add a new row after the current position

C-o

Move down the current position to the end of the line

C-m-o

Delete empty rows near the current location

C-x C-o

Connect the current row to the previous row

m-^

Remove whitespace near the cursor

m-/

Uppercase and lowercase conversions

Convert words to Uppercase

M-u

Word converted to lowercase

M-l

Word Conversion First letter capitalization

M-c

Area converted to uppercase

C-x C-u

Area converted to lowercase

C-x c-l

Miniature buffers

Complete as many as you can

TAB

Fill up to a single word

Spc

Complement and Execute

Ret

Show possible completion of a complete item

?

Switch to previous input

M-p

Switch to the next input

M-p

Search history with regular expressions

M-r

Forward search history with regular expressions

K-5

Terminate command

C-g

Buffer

Select another buffer

C-x b

List all buffers

C-x C-b

Close a buffer

C-x K

Buffer

Swap characters

C-t

Exchange words

M-t

Swap lines

C-x C-T

Interchange expressions

C-m-t

Exchange

Swap characters

C-t

Exchange words

M-t

Swap lines

C-x C-T

Interchange expressions

C-m-t

Spell check

See Car current word spelling

m-$

Check all the words in the area

M-x ispell-region

Check the entire buffer

M-x Ispell-buffer

Label

Find tags

M-.

Find Next Label

C-u m.

Specify a new label

M-x visit-tags-table

All files within the label table are searched with regular expressions

M-x Tags-search

Run a query replacement within all files

M-x Tags-query-replace

Continue to the last label search or query substitution

M-,

Shells

Execute an external command

m-!

Run a shell command in the current zone

m-|

Use an external command to process the current zone

C-u m-|

Start a shell

M-x Shell

Rectangular Area

Copy a rectangular region to a register

C-x R R

Delete a rectangular area

C-x R K

Pull back the contents of the rectangular area

C-x R y

Insert a rectangular area

C-x R O

Empty rectangular Area

C-x R C

Replace each line of content in a rectangular region with a string

C-x R T

Abbreviation

Add global abbreviation

C-x A G

Add pattern abbreviation

C-x a L

Add a global extension to this abbreviation

C-x a I G

Add a pattern extension to this abbreviation

C-x a i L

Extension abbreviations

C-x A E

Dynamically extending the previous word

m-/

Regular expressions

Match any character other than line break

.

Repeat any time

*

Repeat one or more times

+

Not once or once.

?

Escape character

/C

Branch

/|

Group

/(.../)

Group N

/n

Word Start or end

/b

Non-word start or end

/b

Unit

Begin

End

Yes

^

$

Word

/<

/>

Buffer

/‘

/‘

Character category

The

does not match

Character Set fit

[ ... ]

[^ ... ]

Words

/w

/w

Internationalized Character Set

Specify language

M-x set-language-environment

Show all input methods

M-x List-input-methods

Turn IME on or off

c-/

Set the command encoding system

C-x RET C

Show All coding Systems

M-x List-coding-systems

Choosing a Coding System

M-x Prefer-coding-system

Information

Enter the information document reader

C-h I

Find a specified function or variable in an information document

C-h C-i

Move around in a node

Scroll forward

Spc

Reverse scrolling

Del

At the beginning of the node

.

Move between nodes

Next node

N

Previous node

P

Up a layer

U

Select menu items by name

M

Select Nth menu item

N

Fill in the node

F

Returns the node that was last located

L

Return to the Directory node

D

Jump to any node by name

G

Other:

Go to the Quick guide

H

Exit information Document

Q

Searching for nodes with regular expressions

M-s

Register

Save Area to register

C-x R S

Inserting the register contents into the buffer

C-x R I

Save current position to register

C-x R SPC

Jump to a location saved in a register

C-x R J

Keyboard macros

Start recording keyboard macros

C-x (

End record Keyboard macro

C-x)

Execute the last macro

C-x E

Append content to the last keyboard macro

C-u C-x

Give the last keyboard macro a name

M-x Name-last-kbd-macro

Insert a LISP definition of a keyboard macro into the current buffer

M-x Insert-kbd-macro

    • The collection

Quick reference for Emacs common commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.