emacs-studynode

QUIT EMACS

To quit Emacs, press: . (Be sure to use ,
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 character, type
C-q C-c . To insert a , type C-q C-q . To insert a tab, use C-q TAB

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