emacs快捷键

      C-  意思是按住 Ctrol 键
      M-    意指 Meta 键 (键盘上若无Meta 键,则可以ALT ESC 键来取而代之)
      DEL  意指退格键 (不是 删除(Delete) key)
      RET  意指回车键
      SPC  意指空格键
      ESC  意指Escape键

      TAB  意指Tab键

用方向键   
                  C-p (Prev line)
                          /\                     
                          ||                     
                          ||                                                                               
    C-b < --- point--->   C-f (Forward  character)
  (Backward )  ||
                          ||                     
                          \/                     
                  C-n (Next line)


进入Emacs
要进入GNU Emacs                            emacs
离开Emacs
1.挂起Emacs:                              C-z
2.永久离开Emacs                            C-x C-c
回到Emacs                                 fg

文件
读取文件到Emacs                            C-x C-f
保存文件到磁盘                              C-x C-s
保存所有文件                               C-x s
插入其它文件的内容到当前缓冲                  C-x i
用将要读取的文件替换当前文件                  C-x C-v
将当前缓冲写入指定的文件                     C-x C-w
Version control checkin/checkout     
                                         C-x C-q

取得帮助
进入帮助系统很简单,只需要输入C-h(或F1)并跟随要获取帮助的对象,初次使用Emacs的用户可以输入
进入使用手册                          C-h t
离开帮助窗口                          C-x 1
滚动帮助窗口                          C-M-v
匹配:显示与字符a串匹配的命令            C-h a
显示一个键的功能                       C-h c
详细描述一个功能                       C-h f
取得详细模式的信息                     C-h m

错误恢复
取消当前要执行的命令                               C-g
恢复系统崩溃后丢失的文件                            M-x recover-file
撤销更新                                         C-x u或C-_
使缓冲回复到初始内容                               M-x revert-buffer
重绘窗口                                         C-l

增量查找(Incremental Search)
向前查找                                         C-s
向后查找                                         C-r
规则表达式查找                                    C-M-s
反向规则表达式查找                                 C-M-r
选择前一个查找字符串                               M-p
选择下一个查找字符串                               M-n
退出增量查找                                      RET
取消上一个字符的作用                               DEL(Backspace)
退出当前查找模式                                  C-g
在查找的过程中可重复使用C-s和C-r来改变查找方向

移动(Motion)
向前一个字符                                     C-f
向后一个字符                                     C-b
向前一个字                                       M-f
向后一个字                                       M-b
向上一行                                        C-p
向下一行                                        C-n
到行首                                          C-a
到行尾                                          C-e
到句首                                          M-a
到句尾                                          M-e
到段首                                          M-{
到段尾                                          M-}
到页首                                          C-x [
到页尾                                          C-x ]
到表达式首部                                     C-M-f
到表达式尾部                                     C-M-b
到函数首部                                       C-M-a
到函数尾部                                       C-M-e
到缓冲首部                                       M-<
到缓冲尾部                                       M->
滚动到下一屏                                     C-v
滚动到上一屏                                     M-v
滚动到右边一屏(内容向左移动)                      C-x <
滚动到左边一屏(内容向右移动)                      C-x >
滚动当前行到屏幕中央                              C-u C-l

Killing和Deleting
向前delete字符                                  C-d
向后delete字符                                  DEL(Backspace)
向前delete到字首                                M-d
向后delete到字尾                                M-DEL(Backspace)
向前delete到行首                                M-0 C-k
向后delete到行尾                                C-k
向前delete到句首                                C-x DEL(Backspace)
向后delete到句尾                                M-k
向前delete到表达式首部                           M-- C-M-k
向后delete到表达式尾部                           C-M-k
Kill区域                                       C-w
拷贝区域到Kill Ring                             M-w
Kill到下一个给定字符出现的位置                     M-z < char>
拉回(yank)上次kill的内容                        C-y
用更早kill的内容取代拉回的上次kill的内容             M-y

标记(Marking)
标记当前位置                                     C-SPC或C-@
以字符为单位使用移动命令动态标记区域                 C-x C-x
以字为单位使用移动命令动态标记区域                   M-@
标记一段                                        M-h
标记一页                                        C-x C-p
标记一个表达式                                   C-M-@
标记一个函数                                     C-M-h
标记整个缓冲区                                   C-x h

Query Replace
交互式地替换一个文本串                             M-%
交互式地替换一个规则表达式                          M-x query-replace-regexp
替换当前的并移动到下一处                            SPE
替换当前的但不移动到下一处                          ,
不替换当前的并移动到下一处                          L(Backspace)
替换所有剩下的符合条件的文本                        !
退出替换模式                                     RET
进入递归的编辑模式                                C-r
退出递归的编辑模式                                C-M-c

多窗口(Multiple Windows)
(When two commands are shown,the second is for “other frame”)
删除所有其它窗口                                  C-x 1
上下分割当前窗口                                  C-x 2 C-x 5 2
左右分割当前窗口                                  C-x 3
删除当前窗口                                     C-x 0 C-x 5 0
滚动其它窗口                                     C-M-v
切换光标到另一个窗口                               C-x o
选择另一个窗口中的缓冲                             C-x 4 b C-x 5 b
显示另一个窗口中的缓冲                             C-x 4 C-o C-x 5 C-o
在另一窗口中查找并打开文件                          C-x 4 f C-x 5 f
在另一窗口中以只读方式打开文件                        C-x 4 r C-x 5 r
在另一窗口中运行dired命令                           C-x 4 d C-x 5 d
在另一窗口中查找tag                                C-x 4 . C-x 5 .
增加窗口高度                                      C-x ^
减小窗口宽度                                      C-x {
增加窗口宽度                                      C-x }

格式(Formatting)
缩进当前行(与模式相关)                            TAB
缩进区域(与模式相关)                              C-M-
缩进表达式(与模式相关)                            C-M-q
Indent region rigidly arg. Columns             C-x TAB
在光标后插入一个新的行                              C-o
静态地将一行下移                                    C-M-o
删除光标附近的空行(留下一行)                        C-x C-o
与上一行合并成一行                                  M-^
删除光标附近的所有空格                               M-
删除光标附近的空格(留下一格)                          M-SPC
Fill paragraph                                    M-q
Set fill column                                  C-x f
设置每一行开始的前缀                                 C-x .
设置字体                                           M-g

Case Change
将一个字设置为大写                                     M-u
将一个字设置为小写                                     M-l
将一个字首字母设置为大写                                M-c
将一个区域设置为大写                                   C-x C-u
将一个区域设置为小写                                   C-x C-l

The Minibuffer
(the following keys are defined in the minibuffer)
最大程度地补全命令                                     TAB
补全命令中的一个字                                     SPC
完成并执行一个命令                                     RET
列出命令所有可能的后续部分                               ?
列出在当前命令之前输入的命令                             M-p
列出在当前命令之后输入的命令                             M-n
用规则表达式在命令历史记录中向后搜寻                      M-r
用规则表达式在命令历史记录中向前搜寻                      M-s
重复执行上一条命令                                     C-x ESC ESC

缓冲(Buffer)
选择另一个缓冲                                        C-x b
列出所有的缓冲                                        C-x C-b
Kill一个缓冲                                         C-x k

置换(Transposing)
字符置换                                             C-t
字置换                                               M-t
行置换                                               C-x C-t
表达式置换                                            C-M-t

拼写检查(Spelling Check)
对当前的字进行拼写检查                                   M-$
检查区域内所有的字                                      M-x ispell-origin
检查缓冲内所有的字                                      M-x ispell-buffer

标记 (Tags)
查找标记                                               M-.
查找标记下一次出现的位置                                  C-u M-.
指定一个新的标记文件                                       M-x visit-tags-table

Regexp search on all files in tabs table             M-x tags-search
在所有文件中执行查询-替换                                 M-x tags-query-replace
继续进行上一次标记查找或查询-替换                          M-,

Shells
执行一个shell命令                                      M-!
在一个区域上执行sheel命令                               M-|
通过shell命令过滤区域                                   C-u M-|
在窗口中启动一个shell                                  M-x shell

矩形(Rectangles)
拷贝一个矩形到寄存器                                   C-x r r
Kill矩形                                            C-x r k
拉回矩形                                             C-x r y
打开一个矩形, 将文本移动至右边                           C-x r o
清空矩形                                             C-x r c
为矩形中每一行加上一个字符串前缀                         C-x r t

规则表达式(Regular Expressions)
除换行符外的所有单个字符                                  .
零个或多个重复                                          *
一个以上的重复                                          +
零个或一个重复                                          ?
转译字符                                                                           
选择(or)                                             |
分组                                                  (…)
与第n个组相同的文本                                      n
At work break                                         b
Not at work break                                     B

寄存器(Register)
存储区域到寄存器                                   C-x r s
插入矩形内容到缓冲                                  C-x r i
存储光标位置到寄存器                                C-x r SPC < num>
跳跃到寄存器中存储的光标位置                        C-x r j < num>

键盘宏(Keyboard Macros)
开始定义一个键盘宏                                C-x (
结束键盘宏的定义                                  C-x )
执行上一次定义的键盘宏                              C-x e
追加到上一个键盘宏                                 C-u C-x (
为上一个键盘宏命名                                 M-x name-last-kbd-macro
在缓冲中插入Lisp                                  M-x insert-kbd-macro  

posted on 2010-07-11 20:30  Xuemin_Zhang  阅读(469)  评论(0编辑  收藏  举报