QUIT EMACS
To quit Emacs, press:
not
在item2中设置meta键
开启
emacs
开启-不显示splash screen
emacs -Q
开启特定的文件
emacs XXX
emacs -Q XXX
Stopping Emacs
C-x C-c
save files
press y to save and n to not save.To save all of the files at once and then quit, press ! (exclamation mark). To quit
immediately, without saving anything more, press q . To save the current file only, but
quit without saving anything else, press . (period).
c-p previous-line
c-n next-line
c-f 向后移动一个字符
M-f 向后移动一个word
C-x C-b display a list of all your buffers
C-x h C-w .清空buffer ( C-x h selects the entire buffer; C-w erases the
selection.)
C-g 退出指令
C-x k kills (deletes) the current buffer
C-x b Switch to buffer
C-x 0 (the number zero). This tells Emacs to kill (get rid of) the selected window
C-v to scroll down one screenful
M-v to scroll up one screenful
M-x 输入命令
C-d 消除右边得一个字符
C-o open the new line
C-k 删除后面的所有字符
Here are the details for using C-o . If you are at the beginning of a line, C-o
creates a new, empty line above the current line. If you are at the end of a line, C-o
creates a new, empty line below the current line. If you are within a line, C-o breaks it
into two separate lines
To insert one of these characters into your text, first press C-q . This tells Emacs
that the next character is to be taken literally. (Think of the q as meaning “quote”; that
is, to take the next key you type literally.) Thus, to insert a
C-q C-c . To insert a
C-x BS delete from the current position, backwards, to the beginning of the sentence.(从当前点删到尾)
撤销 & 反撤销
C-x u 撤销
C-- 撤销
C-/ 撤销
在撤销的时候如果撤销多了需要进行反撤销
具体是用C-f等打断当前撤销操作,接着进行的撤销动作就是反撤销。
C-x z 重复之前的操作 重复多次可以只按zzzz
Windows
C-x 0 delete the select window
C-x 1 delete all windows excpet select window
C-x 2 Split select window verticall
C-x 3 Split select window horizontally
C-x o move cursor to the next (other) Windows
C-x } Make selected windows wider
C-x { Make selected windows narrower
C-x ^ Make selected windows narrower
buffer
C-x b When you press C-x b , Emacs will wait for you to enter the name of the buffer with
which you want to work. If this buffer already exists, Emacs will just move it into the
window. Otherwise, Emacs will create a brand new empty buffer in the window using
the name you specified. Thus, C-x b is the command to use when you want to create a
new buffer.
C-x 4 b tells Emacs to display whichever buffer you specify in a different window
C-x 4 C-o command. This is similar to the C-x 4 b command, except that the selected window does not change
C-x k kill a buffer
file
C-x C-f 打开一个文件的buffer
C-x C-v replace buffer contents with specified file
C-x C-s Save a buffer to file
C-x C-w Save a buffer to special file
C-x i insert contents of a file into buffer 把文件插入到此buffer中
C-x 4 C-f read a file into next window
C-x 4 f same as C-x 4 C-f
C-x 4 r same as C-x 4 C-f read-only
cursor
C-f 后一个字符 C-b 前一个字符
M-f 后一个word M-b 前一个word
C-p 前一line C-n 后一line
M-a M-e sentence ?
M-{ M-} paragraph 空格分隔段落
C-a C-e 当前行
重复一个命令多次
M-number C-p 重复一个命令多次
C-u number 重复一个命令多次
C-u repeat the command 4 times
C-u C-u repeat the command 16 times
C-u C-u C-u repeat the command 64 times
scroll
C-v scroll down
M-v scroll up
M-C-v scroll down in next windows
M- < jump to start of the buffer
M- > jump to end of the buffer
C-l 将当前行放置在屏幕的中间。
M-g g 跳到指定行
M-x line-number-mode toggle miinbuf下方显示行
C-SPC 标记
M-= 统计字符多少
C-x C-x curson到mark的位置。 再次按C-x C-x 交换位置
M-@ 设置当前curson的单词末尾
M-number M-@ 设置当前curson的number个word后
M-h Put region arounnd paragraph
C-x h Put region arounnd entire buffer
operating the region
C-w kill all the characters
C-x C-l Convert the characters to lower
C-x C-u Convert the characters to lower
M-= count
M-| Run the shell command use the characters as data example:M -| sort -u
delete
delete不会保存
ESC number
M-:
删除空格
1 | To continue, the M-\ (<Meta-Backslash>) command erases any space or tab |
M-SPC: 删除空格 保留一个空格
1 | The M-SPC (<Meta-Space>) command is similar, except that it leaves exactly |
C-x C-o:
删除紧临的空行
1 | The C-x C-o command performs the analogous operation for blank lines |
M-^
合并到一行,注意curson要放在第二行
1 | Finally, the M-^ command joins two lines into one long one. This command |
Kill Text
会保留删除的文本
C-k 删除后面的文本
M-d kill word
M-BS kill word Forward
C-w kill the region
M-z char
To erase an entire line: if you are at the beginning of the line, press C -k C-k . If you
are not at the beginning of the line, press C-a C-k C-k .
COPY
C-y yank most recently killed text
C-u C-y same as . curson at the beging
M-y replace the yank test with previous killed Text
M-w Copy region to kill ring,without erasing
M-C-W Apend next kill to newest kill ring entry
correcting
M - BS kill the previous word
C-x BS kill backwards to beginning of sentence
M–M-l change previous word to lower
M–M-u change previous word to upper
M–M-c change previous word to lower,initial cap
M-l change follow word to lower
M-u change follow word to upper
M-c change follow word to lower,initial Cap
ESC 10 M-- M-c chage many times
C-t transport two adjaent charactors
M-t transport two adjaent words
C-x C-t transport two adjaen lin
search
C-s foword: Incremental search
C-s RET foword: no-Incremental search
M-s w Foward Non-increment word search
M-C-s foword: Incremental regexp search
M-C-s RET foword: No-Incremental regexp search
The basic type of Emacs search is called an INCREMENTAL SEARCH. That
means Emacs starts searching as soon as you type a single character. With each
character you type, Emacs refines its search.
C-r foword: Incremental search
C-r RET foword: no-Incremental search
M-r w Foward Non-increment word search
M-C-r foword: Incremental regexp search
M-C-r foword: No-Incremental regexp search
when you searchig:
C-s if you do again . search next
C-r same as
C-w Copy the word afer point to search string
C-y Copy kill ring afer point to search string
M-y replace next kill ring
replace
M - % search and replace
M-C- % search and replace regexp
M-x replace-string
M-x replace-regexp
• SPC (
• BS (
• ! (exclamation mark) to make all the rest of the replacements automatically with
no more questions.
• RET (
M-x replace-string makes all the replacements automatically without
asking you any questions.
M-x replace-regexp makes all the replacements automatically, while
allowing you to use a regular expression for the search pattern.
Recursive Editing
C-r when you searing and want interrupt to do other things
M-C-c This will stop recursive editing and return you to the search and replace operation, exactly where you left off.