2022-07-13 16:26:16 +08:00
|
|
|
#+STARTUP: indent
|
2022-07-13 19:33:17 +08:00
|
|
|
#+TITLE: Editor Cheatsheet
|
|
|
|
|
2022-07-13 16:26:16 +08:00
|
|
|
|
|
|
|
* VIM
|
|
|
|
** deletion
|
|
|
|
| key | usage |
|
|
|
|
|-------+------------------------|
|
|
|
|
| x | 删除光标所在处单词 |
|
|
|
|
| de | 删除到本单词末尾 |
|
|
|
|
| db | 删除到前一个单词 |
|
|
|
|
| d$ | 删除光标位置到本行结束 |
|
|
|
|
| d0 | 删除光标位置到本行开头 |
|
|
|
|
| u/C-r | 撤销/重做 |
|
2022-07-25 12:47:10 +08:00
|
|
|
| c i { | change inside {} |
|
2022-07-13 16:26:16 +08:00
|
|
|
|
|
|
|
** movement
|
2022-07-25 12:47:10 +08:00
|
|
|
| key | usage |
|
|
|
|
|------------+-----------------------------|
|
|
|
|
| w | 下一个单词 |
|
|
|
|
| e | 单词尾 |
|
|
|
|
| b | 单词头 |
|
|
|
|
| 0/$ | 行首/尾 |
|
|
|
|
| H/M/L | 当前页面可见顶部/中间/底部 |
|
|
|
|
| <num> G | 跳转到第几行 |
|
|
|
|
| C-u(f)/d | 上/下翻页 |
|
|
|
|
| f/F <char> | 在一行中向后/前跳到某个字符 |
|
|
|
|
| % | 到对应括号 |
|
|
|
|
|
|
|
|
|
2022-07-13 16:26:16 +08:00
|
|
|
|
|
|
|
** visual
|
|
|
|
| key | usage | next |
|
|
|
|
|-----+--------------+------------------------|
|
|
|
|
| V | 行选择 | |
|
|
|
|
| C-v | 矩形区域选择 | S-i 插入, esc 批量执行 |
|
|
|
|
| v | | movement |
|
|
|
|
| | | |
|
|
|
|
|
|
|
|
|
|
|
|
** file/split
|
|
|
|
| key | usage |
|
|
|
|
|-------------+--------------|
|
|
|
|
| :n/:N | 文件之间切换 |
|
|
|
|
| :b | 切换到文件 |
|
|
|
|
| C-w h/j/k/l | 切换分屏窗口 |
|
|
|
|
| ZZ | :wq |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* EMACS
|
|
|
|
** org-mode
|
|
|
|
| key | usage |
|
|
|
|
|-----------+-----------|
|
|
|
|
| C-c \vbar | 创建表格 |
|
|
|
|
| C-c C-e | 导出 HTML |
|
|
|
|
| | |
|
|
|
|
| | |
|
2022-07-18 14:40:59 +08:00
|
|
|
|
|
|
|
** normal
|
2022-07-25 12:47:10 +08:00
|
|
|
| key | usage |
|
|
|
|
|---------+---------------------|
|
|
|
|
| C-s | 搜索 |
|
|
|
|
| M-% | 替换 |
|
|
|
|
| C-_ | [[https://linuxtoy.org/archives/emacs-undo-tree.html][undo/redo]] |
|
|
|
|
| M-; | 区域切换注释 |
|
|
|
|
| C-x C-; | 行切换注释 |
|
|
|
|
| C-y | paste to minibuffer |
|
2022-07-18 14:40:59 +08:00
|
|
|
|
|
|
|
* Git (虽然不算editor, 但是先也放这吧)
|
|
|
|
#+BEGIN_SRC shell
|
|
|
|
git log --stat | perl -ne 'END { print $c } $c += $1 if /(\d+) insertions/;'
|
|
|
|
git log --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
|
|
|
|
#+END_SRC
|