Emacs 快捷键

来源:互联网 发布:java 多线程 ftp上传 编辑:程序博客网 时间:2024/05/17 04:04

move:
-------------------
C-f/b, forward/backward a char
M-f/b, by word
C-p/n, previous/next line
C-a/e, move to beginning/end of a line
M-a/e, move to xxx of a sentence
M-<, begin of the whole text
M->, end of the whole text
C/M-v, move forward/backward one screenful
C-l, center
M-g g, jump to a line


repeat:
-------------------
C-u 8 C-f, repeat C-f 8 times
C-u x C-f, x is a repeat-count, for most/but not all commands
M-x C-f, C-u x C-f


edit:
-------------------
Delback/C-d, delete the character/next char
M-Delback/M-d, delete by word
C/M-k, kill to end of line/sentence
C-y, yanking
M-y(after C-y), yanking with the previous kill
C/M-w, kill/copy sth
C-/, undo
C-_, undo
C-x C-t, move the current line down
M-q, re-fill paragraph


select-region:
-------------------
C-space, set region begin
C-x C-x, show region
M-h, select a sentence
C-x h, select the whole buff


file:
-------------------
C-x C-f, find a file
C-x C-v, find-alternate-file
C-x C-b, list buffers
C-x b buffname, switch to buffname
C-x C-s, save file
C-x s, save all files
C-x C-w, write as another file


buffer:
-------------------
C-x k, kill buffer
C-x C-q, set readonly


Emacs autosave file:
-------------------
#filename.a#
M-x recover-file, to recover file from autosave file


mode
-------------------
M-x fundamental-mode, switch major mode


search & replace:
-------------------
C-s, I-search
C-r, reverse of C-s
C-s C-w, search word which matchs the next word
C-s Enter C-w, match the whole word
C-r Enter C-w, reverse search
M-%, begin to replace, space to accept replace, n not replace, ! replace all, q quit replace


bookmark
-------------------
C-x r m, set
C-x r b, jump to
C-x r l, list all, then
   d mark bookmark for deletion
   r rename bookmark
   s save all listed bookmarks
   v show marked bookmarks (or the one the cursor is over)
   x delete marked bookmarks
   q quit bookmark list


multi-windows
-------------------
C-M-v, scroll the other window
C-x o, move to the other window
C-x 0/1/2/3
C-x 4 f, open file in the other window
C-x 4 b, open another file in the other window
C-x {/}, set window size


Frames
-------------------
M-x make-frame, make frame
M-x delete-frame, delete current frame
M-x 5 2/1, make frame/delete the other frame


execute command:
-------------------
M-!, execute one line command
M-h M-|, execute shell command
C-u M-!, execute shell command and insert output to the current buffer
M-x shell, open shell mode


help:
-------------------
M-x man, open man page, eg M-x man Enter 3 sleep Enter
M-x info,
M-x help, get help
C-h c command, a brief description of the command, eg: C-h c C-p
C-h k command, to get more info about command
C-h a x,
C-h f x,
C-h i,
C-h r,
C-h m, show docmentation on the current major & minor mode


as IDE:
-------------------
C-x `,
M-n/p, next/previous compile error
M-;, add comments
M-j(after M-;), add comments in the next line
C-j, add code in the next line
M-x comment-region/uncomment-region, comment a region
M-x kill-comment, kill comment on the current line
C-M-/, format region


C++ editor:
-------------------
C-M-a/e, begin/end of function
C-M-h, region the whole function
C-c C-u, goto begin of mac
C-c C-n/p,
C-c C-c, comment current line
C-c C-a, auto new line
C-c C-d, hungry-delete-key, delete all space
C-c C-t, C-c C-a + C-c C-d
M-x c-set-style, set style like Linux
M-/, auto fill
M-x show-paren-mode, set show paren mode


compare
-------------------
M-x ediff,


file manager
-------------------
M-x dired,


etags
-------------------


svn
-------------------


Tips
-------------------
1,After open a select window by Tab auto fit, hit PgUp to switch to the select buffer;
2,<ESC><ESC><ESC>, all-purpose "get out" command