配置参考自:http://www.braveclojure.com/basic-emacs/
C+g 取消当前的动作
缓存区的操作
C-x b 进行缓冲区的操作
C-x k 关闭一个缓冲区
操作文件
C-x C-f 打开文件
C-x C-s 保存文件
-----------------------------------------------------------------
总结:
- In Emacs, editing takes place in buffers
- To switch to a buffer, do
C-x b
and enter the buffer name in the minibuffer - To create a new buffer, do
C-x b
and enter a new buffer name - To open a file, do
C-x C-f
and navigate to the file - To save a buffer to a file, do
C-x C-s
. - To create a new file, do
C-x C-f
and enter the new file's path. When you save the buffer, Emacs will create the file on the file system.
移动操作
C-a | Move to beginning of line |
M-m | Move to the first non-whitespace character on the line |
C-e | Move to end of line |
C-f | Move forward one character |
C-b | Move backward one character |
M-f | Move forward one word (I use this a lot) |
M-b | Move backward one word (I use this a lot, too) |
C-s | Regex search for text in the current buffer and move to it. Hit C-s again to move to the next match |
C-r | Same as above, but search in reverse |
M-< | Move to beginning of buffer |
M-> | Move to end of buffer |
M-g g | Go to line |
选择/区域
C-spc M-f
代换操作
M-x
Here's a summary of key bindings:
C-w | Kill region |
M-w | Copy region to kill ring |
C-y | Yank |
M-y | Cycle through kill ring after yanking |
M-d | Kill word |
C-k | Kill line |
窗口操作
按键 | 命令 | 作用 |
---|---|---|
C-x 2 | split-window-vertically | 垂直拆分窗口 |
C-x 3 | split-window-horizontally | 水平拆分窗口 |
C-x o | other-window | 选择下一个窗口 |
C-M-v | scroll-other-window | 滚动下一个窗口 |
C-x 4 b | switch-to-buffer-other-window | 在另一个窗口打开缓冲 |
C-x 4 C-o | display-buffer | 在另一个窗口打开缓冲,但不选中 |
C-x 4 f | find-file-other-window | 在另一个窗口打开文件 |
C-x 4 d | dired-other-window | 在另一个窗口打开文件夹 |
C-x 4 m | mail-other-window | 在另一个窗口写邮件 |
C-x 4 r | find-file-read-only-other-window | 在另一个窗口以只读方式打开文件 |
C-x 0 | delete-window | 关闭当前窗口 |
C-x 1 | delete-other-windows | 关闭其它窗口 |
C-x 4 0 | kill-buffer-and-window | 关闭当前窗口和缓冲 |
C-x ^ | enlarge-window | 增高当前窗口 |
C-x { | shrink-window-horizontally | 将当前窗口变窄 |
C-x } | enlarge-window-horizontally | 将当前窗口变宽 |
C-x - | shrink-window-if-larger-than-buffer | 如果窗口比缓冲大就缩小 |
C-x + | balance-windows | 所有窗口一样高 |
windmove-right | 切换到右边的窗口(类似:up, down, left) |