(Editor) Cheatsheet
$Id: cheatsheet.org,v 25.7 2025/06/12 16:09:25 dongdigua Exp $
1. VIM
1.1. deletion
| key | usage |
|---|---|
| D | delete to end of line |
1.2. edit
| key | usage |
|---|---|
| u/C-r | 撤销/重做 |
| c i { | change inside {} |
| "{register}y/p | 向/从寄存器拷贝 |
| = | indent |
1.3. movement
| key | usage |
|---|---|
| w/e | 下一个单词/单词尾 |
| b | 单词头 |
| H/M/L | 当前页面可见顶部/中间/底部 |
| C-u(f)/d | 上/下翻页 |
| % | 到对应括号 |
| {} | 段落跳转 |
| g ; | goto last change |
| g */# | 正/反查找光标下的词 |
| g d/D | 跳转到本地/全局定义 |
| C-w | jump between splits |
| C-o/i | Older/Newer position |
| ` | mark |
| g-j/k | move visual line |
1.4. file/split
| key | usage |
|---|---|
| :n/:N | 文件之间切换 |
| :b | 切换到文件 |
| C-w h/j/k/l | 切换分屏窗口 |
| gt/T | next/prev tab |
| :%!xxd (-r) | edit in hex |
2. EMACS
2.1. org
| key | usage |
|---|---|
| C-c | | 创建表格 |
| C-c C-e | 导出 HTML |
| C-c C-x C-v | toggle render images |
| C-c C-l | 编辑链接 |
| C-c C-, | org-insert-structure-template |
| C-c C-x p | org-set-property |
| C-u C-c C-l | Autocomplete when editing file links |
https://orgmode.org/worg/dev/org-export-reference.html
Bold italic underline strikethrough code verbatim
2.2. normal
| key | usage |
|---|---|
| M-% | 替换 |
| M-; | 区域切换注释 |
| C-x C-; | 行切换注释 |
| C-y | paste to minibuffer |
| M-&/! | async/shell command |
| C-M-\ | indent-region |
| M-y | past previous |
| C-x ^ | enlarge-window |
| C-q <tab> | insert a tab |
| C-x C-+/- | text-scale-adjust |
| g x | browse-url-at-point |
2.3. eww/elpher (essensial)
| key | usage |
|---|---|
| TAB | shr-next-link/elpher-next-link |
| d | eww-download/elpher-download |
| g | eww-reload/elpher-go |
| G | eww |
| l | eww-back-url |
| ˆ | elpher-back-url |
| & | eww-browse-with-external-browser |
| w | eww-copy-page-url |
| C/c | elpher-copy-current/link-url |
| v | eww-view-page-source |
| . | elpher-view-raw |
2.4. tramp
sudo/doas
/ssh:host|doas::/path
3. Git
Git 能离线使用只是个传说, 你仍然需要联网搜索该用哪个命令传什么参数
magic is useful
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 }' git show :1:file # 1common 2ours 3theirs git rebase --committer-date-is-author-date
4. Shell
4.1. Fish
| key | usage |
|---|---|
| M-Left/Right | jump world, or prevd/nextd |
| M-s | sudo the last command |
| M-w | what is this |
5. ffmpeg
ffmpeg -hwaccel qsv -i IN -ss 5:00 -t 60 -s 720x480 -r 30 -an -threads 2 OUT