Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4231
  • 博文数量: 3
  • 博客积分: 90
  • 博客等级: 民兵
  • 技术积分: 32
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-05 23:37
文章分类
文章存档

2012年(3)

我的朋友
最近访客

分类: LINUX

2012-09-06 22:12:30

C = Control
M = Meta = Alt|Esc

Basics 基本快捷键
C-x C-f "find" file i.e. open/create a file in buffer ("find"文件, 即在缓冲区打开/新建一个文件)
C-x C-s save the file (保存文件)
C-x C-w write the text to an alternate name (使用其他文件名另存文件)
C-x C-v find alternate file (关闭当前缓冲区文件并打开新文件)
C-x i insert file at cursor position (在当前光标处插入文件)
C-x b create/switch buffers (新建/切换缓冲区)
C-x C-b show buffer list (显示缓冲区列表)
C-x k kill buffer (关闭当前缓冲区)
C-z suspend emacs (挂起emacs--最小化)
C-X C-c close down emacs (关闭emacs)

Basic movement 光标移动基本快捷键
C-f forward char (后一个字符)
C-b backward char (前一个字符)
C-p previous line (上一行)
C-n next line (下一行)
M-f forward one word (后一个单词)
M-b backward one word (前一个单词)
C-a beginning of line (行首)
C-e end of line (行尾)
C-v one page up (向下翻一页)
M-v scroll down one page (向上翻一页)
M-< beginning of text (到文件开头)
M-> end of text (到文件末尾)

Editing 编辑
M-n repeat the following command n times (重复执行后一个命令n次)
C-u repeat the following command 4 times (重复执行后一个命令4次)
C-u n repeat n times (重复执行后一个命令n次)
C-d delete a char (删除后一个字符)
M-d delete word (删除后一个单词)
M-Del delete word backwards (删除前一个单词)
C-k kill line (移除一行)

C-Space[C-@] Set beginning mark (for region marking for example) (设置开始编辑(例如标记区域))
C-w "kill" (delete) the marked region region (移除标记区域的内容)
M-W copy the marked region (复制标记区域的内容)
C-y "yank" (paste) the copied/killed region/line (召回复制/移除的区域/行)
M-y yank earlier text (cycle through kill buffer) (召回更早的内容(在kill缓冲区内循环))
C-x C-x exchange cursor and mark (交换光标和标记)

C-t transpose two chars (交换两个字符的位置)
M-t transpose two words (交换两个单词的位置)
C-x C-t transpose lines (交换两行的位置)
M-u make letters uppercase in word from cursor position to end (使光标处到单词结尾处的字母变成大写)
M-c simply make first letter in word uppercase (使光标处的单词的首字母变为大写,其他小写)
M-l opposite to M-u (与 M-u 相反)

Important 重要快捷键
C-g quit the running/entered command (停止当前运行/输入的命令)
C-x u undo previous action (撤销前一个命令)
M-x revert-(空格或-)buffer RETURN(回车) (insert like this) undo all changes since last save ((照着这样输入)撤销上次存盘后所有改动)
M-x recover-file RETURN Recover text from an autosave-file (从自动存盘文件(#name#)恢复)
M-x recover-session RETURN if you edited several files (如果编辑了几个文件,用这个恢复)

Online-Help 在线帮助
C-h c which command does this keystroke invoke (显示快捷键绑定的命令)
C-h k which command does this keystroke invoke and what does it do? (显示快捷键绑定的命令及其作用)
C-h l what were my last 100 typed keys (显示最后100个键入的内容)
C-h w what key-combo does this command have? (显示命令被绑定到哪些快捷键)
C-h f what does this function do (显示函数的功能)
C-h v what's this variable and what is it's value (显示变量的含义和值)
C-h b show all keycommands for this buffer (显示当前缓冲区所有可用的快捷键)
C-h t start the emacs tutorial (打开emacs教程)
C-h i start the info reader (打开info阅读器)
C-h C-k start up info reader and go to a certain key-combo point
C-h C-f show the emacs FAQ (显示emacs FAQ)
C-h p show infos about the Elisp package on this machine (显示本机Elisp包的信息)

Search/Replace 搜索/替换
C-s Search forward (向后搜索)
C-r search backward (向前搜索)
C-g return to where search started (if you are still in search mode) (回到搜索开始前的位置(如果仍然在搜索模式中))
M-% query replace (询问并替换)

Space or y replace this occurence (空格或y 替换当前匹配)
Del or n don't replace (不要替换当前匹配)
. only replace this and exit (replace) (仅仅替换当前匹配并退出(替换))
, replace and pause (resume with Space or y) (替换并暂停(按空格或y继续))
! replace all following occurences (替换以下所有匹配)
^ back to previous match (回到上一个匹配位置)
RETURN or q quit replace (退出替换)


Search/Replace with regular expressions 使用正则表达式搜索/替换
Characters to use in regular expressions: 可在正则表达式中使用的符号:
^ beginning of line (行首)
$ end of line (行尾)
. single char (单个字符)
.* group or null of chars (任意多个(包括没有)字符)
\< beginning of a word (单词开头)
\> end of a word (单词结尾)
[] every char inside the backets (for example [a-z] means every small letter) (方括号中的任意一个字符(例如[a-z]表示所有的小写字母))

M C-s ... RETURN search for regular expression forward (使用正则表达式向后搜索)
M C-r ... RETURN search for regular expression backward (使用正则表达式向前搜索)
M C-s incremental search (增量搜索)
C-s repeat incremental search (重复增量搜索)
M C-r incremental search backwards (向前增量搜索)
C-r repeat backwards (重复向前增量搜索)
M-x query-replace-regexp search and replace (使用正则表达式搜索并替换)

Window-Commands 窗口命令
C-x 2 split window vertically (水平分割窗格)
C-x 3 垂直分割窗格
C-x o change to other window (
切换至其他窗格)
C-x 0 delete window (关闭窗格)
C-x 1 close all windows except the one the cursors in (关闭除了光标所在窗格外所有窗格)
C-x ^ enlarge window (扩大窗格)
M-x shrink-window command says it ;-) (缩小窗格)
M C-v scroll other window (滚动其他窗格内容)
C-x 4 f find file in other window (在其他窗格中打开文件)
C-x 4 o change to other window (切换到其他窗格)
C-x 4 0 kill buffer and window (
关闭当前缓冲区和窗格)
C-x 5 2 make new frame (新建窗口)
C-x 5 f find file in other frame (在新窗口中打开文件)
C-x 5 o change to other frame (切换到其他窗口)
C-x 5 0 close this frame (关闭当前窗口)

Bookmark commands 书签命令
C-x r m set a bookmark at current cursor pos (在光标当前位置创建书签)
C-x r b jump to bookmark (转到书签)
M-x bookmark-rename says it (重命名书签)
M-x bookmark-delete " (删除书签)
M-x bookmark-save " (保存书签)
C-x r l list bookmarks (列出书签清单)

d mark bookmark for deletion (标记等待删除)
r rename bookmark (重命名)
s save all listed bookmarks (保存列表内所有书签)
f show bookmark the cursor is over (转到当前书签指向的位置)
m mark bookmarks to be shown in multiple window (标记在多窗口中打开)
v show marked bookmarks (or the one the cursor is over) (显示被标记的标签(或者光标当前位置的书签))
t toggle listing of the corresponding paths (切换是否显示路径列表)
w " path to this file (显示当前文件路径)
x delete marked bookmarks (删除被标记的书签)
Del ? (取消删除标记)
q quit bookmark list (退出书签列表)


M-x bookmark-write write all bookmarks in given file (将所有书签导出至指定文件)
M-x bookmark-load load bookmark from given file (从指定文件导入书签)

Shell
M-x shell starts shell modus (打开shell模式)
C-c C-c same as C-c under unix (stop running job) (类似unix里的C-c
(停止正在运行的程序))
C-d delete char forward (删除光标后一个字符)
C-c C-d Send EOF (发送EOF)
C-c C-z suspend job (C-z under unix) (挂起程序
(unix下的C-z))
M-p show previous commands (显示前一条命令)M-n show post commands (显示后一条命令)

DIRectory EDitor (dired)
C-x d start up dired (打开dired)
C (large C) copy ((大写C)复制)
d mark for erase (标记等待删除)
D delete right away (立即删除)
e or f open file or directory (打开文件或目录)
g reread directory structure from file (刷新当前目录)
G change group permissions (chgrp) (改变文件所属组
(chgrp))
k delete line from listing on screen (don't actually delete) (从屏幕上的列表里删除一行(不是真的删除))m mark with * (用*标记)
n move to next line (光标移动到下一行)
p move to previous line (光标移动到上一行)
o open file in other window and go there (在另一个窗格打开文件并移动光标到那里)
C-o open file in other window but don't change there (在另一个窗格打开文件但光标不到那里)
P print file (打印文件)
q quit dired (退出dired)
Q do query-replace in marked files (在标记的文件中查找/替换)
R rename file (重命名文件)
u remove mark (移除标记)
v view file content (显示文件内容)
x delete files marked with D (删除有D标记的文件)
z compress file (压缩/解压缩文件)
M-Del remove all marks (whatever kind) (移除所有标记
(默认为所有类型的标记))
~ mark backup files (name~ files) for deletion (标记备份文件(文件名带有~的文件)等待删除)# mark auto-save files (#name#) for deletion (编辑自动保存文件(文件名形如#name#)等待删除)*/ mark directory with * (C-u * removes that mark again) (用*标记所有文件夹)
= compare this file with marked file (将当前文件盒标记文件
(使用C-@标记而不是dired的m标记)比较)
M-= compare this file with it's backup file (将当前文件盒它的备份文件比较)
! apply shell command to this file (对当前文件应用shell命令)
M-} change to the next file marked with * od D (移动光标到下一个用*或D标记的文件)
M-{ " previous " (移动光标到上一个用*或D标记的文件)
% d mark files described through regular expression for deletion (使用正则表达式标记文件等待删除)
% m " (with *) (使用正则表达式标记文件为*)
+ create directory (新建文件夹)
> changed to next dir (移动光标到下一个文件夹)
< change to previous dir (移动光标到上一个文件夹)
s toggle between sorting by name or date (切换排序模式
(按文件名/日期))

Maybe into this category also fits this command: 或许把这个命令归入这一类也很合适
M-x speedbar starts up a separate window with a directory view (打开一个独立的目录显示窗口)

Telnet
M-x telnet starts up telnet-modus (打开telnet模式)
C-d either delete char or send EOF (删除后一个字符或发送EOF)
C-c C-c stop running job (similar to C-c under unix) (停止正在运行的程序
(和unix下的C-c类似))
C-c C-d send EOF (发送EOF)
C-c C-o clear output of last command (清除最后一个命令的输出)
C-c C-z suspend execution of command (挂起正在运行的命令)
C-c C-u kill line backwards (移除前一行)
M-p recall previous command (显示前一条命令)

Text
Works only in text mode 只能在text模式里使用
M-s center line (使当前行居中)
M-S center paragraph (使当前段落居中)
M-x center-region name says (被选中的区域居中)

Macro-commands 宏命令
C-x ( start macro definition (开始定义宏)
C-x ) end of macro definition (结束定义宏)
C-x e execute last definied macro (运行最近定义的宏)
M-n C-x e execute last defined macro n times (运行最近定义的宏n次)
M-x name-last-kbd-macro give name to macro (for saving) (给最近定义的宏命名
(用来保存))
M-x insert-kbd-macro save named macro into file (将已命名的宏)
M-x load-file load macro (载入宏)
M-x macroname execute macroname (运行该命名的宏)

Programming 编程
M C-\ indent region between cursor and mark (自动缩进光标和标记间的区域)
M-m move to first (non-space) char in this line (移动光标到行首第一个
(非空格)字符)
M-^ attach this line to previous (将当前行接到上一行末尾处)
M-; formatize and indent comment (添加缩进并格式化的注释)
C, C++ and Java Modes  C,C++和Java模式
M-a beginning of statement 
(移动光标到声明的开始处)
M-e end of statement (移动光标到声明的结尾处)
M C-a beginning of function (移动光标到函数的开始处)
M C-e end of function (移动光标到函数的结尾处)
C-c RETURN Set cursor to beginning of function and mark at the end (将光标移动到函数的开始处并标记到结尾处)
C-c C-q indent the whole function according to indention style (根据缩进风格缩进整个函数)
C-c C-a toggle modus in which after electric signs (like {}:';./*) emacs does the indention (切换自动换行功能)
C-c C-d toggle auto hungry mode in which emacs deletes groups of spaces with one del-press (一次性删除光标后的一串空格)
C-c C-u go to beginning of this preprocessor statement
C-c C-c comment out marked area
More general (I guess)
M-x outline-minor-mode collapses function definitions in a file to a mere {...}
M-x show-subtree If you are in one of the collapsed functions, this un-collapses it
In order to achive some of the feats coming up now you have to run etags *.c *.h *.cpp (or what ever ending you source files have) in the source directory
为了实现下面的一些技术,需要在保存源代码的目录里运行"etags *.c *.h *.cpp"(或者其他源代码的其他的扩展名)
M-. (Thats Meta dot) If you are in a function call, this will take you to it's definition (
(点)搜索标签)
M-x tags-search ENTER Searches through all you etaged (在所有标签里搜索(使用正则表达式))M-, (Meta comma) jumps to the next occurence for tags-search ((逗号)在tags-search里跳至下一个匹配处)M-x tags-query-replace yum. This lets you replace some text in all the tagged files (在设置过标签的所有文件里替换文本)


GDB (Debugger)
M-x gdb starts up gdm in an extra window (在另一个窗格中打开gdb)

Version Control 版本控制
C-x v d show all registered files in this dir (显示当前目录下所有注册过的文件)
C-x v = show diff between versions (比较不同版本间的差异)
C-x v u remove all changes since last checkin (移除上次提交之后的更改)
C-x v ~ show certain version in different window (在不同窗格中显示某个版本)
C-x v l print log (打印日志)
C-x v i mark file for version control add (标记文件等待添加版本控制)
C-x v h insert version control header into file (给文件添加版本控制文件头)
C-x v r check out named snapshot (获取命名过的快照)
C-x v s create named snapshot (创建命名的快照)
C-x v a create changelog file in gnu-style 
(创建gnu风格的更改日志)
阅读(418) | 评论(0) | 转发(0) |
0

上一篇:就为它,emacs

下一篇:Emacs设置

给主人留下些什么吧!~~