Notes of the Missing Semester

Aronkk

大部分内容可以在中文讲义中查询到,本文只放一些自己认为有意思的东西。 A = Shift-a

Shell

  • touch command to create or modify a file(碰到就更新时间戳,非常生动形象)
  • !! 表示完整的上一条命令,包括参数。当你因为权限不足执行命令失败时,可以使用 sudo !! 再尝试一次
  • 同一行的多个命令可以用 ; 分隔
  • Ctrl-d 退出 Shell

Vim in VSCode

解决 windows 切换到 normal mode 时输入法为中文的问题:

安装 im-select 到 C:/im-select/,然后在 setting json 中添加:

1
2
3
4
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "1033", # 需要在输入法为英文时运行 im-select.exe 获得相应的输入法代码
"vim.autoSwitchInputMethod.obtainIMCmd": "C:\\im-select\\im-select.exe",
"vim.autoSwitchInputMethod.switchIMCmd": "C:\\im-select\\im-select.exe {im}"

删除内容而不保存到剪贴板

关于寄存器 (register):

  • y(复制)
    复制的内容会存入 "0(复制专用寄存器)和 ""(无名寄存器)
  • c(修改)、d(删除)、x(删除字符)
    删除/修改的内容会存入 ""(无名寄存器)和 "1-9(数字寄存器,按操作顺序覆盖) 例如:第一次删除的内容存入 "1,第二次删除存入 "1(原 "1 内容移到 "2,依此类推)
  • :reg 调试寄存器状态

VSCode 内置方法:

删除整行

1
Ctrl-K

删除光标右侧内容

1
Ctrl-Delete

删除光标左侧内容

1
Ctrl-Backspace

使用 black hole register "_

例如使用 "_dd 舍弃 dd 的内容。

Another trick from Stack Overflow:

When you enter the line back with the p command you are pasting the contents of the (volatile) default register "", which has been overwritten by dd. But you still can paste from the (non volatile) yank register "0, which won’t be overwritten by the delete command dd.

Note that Ctrl-v in insert mode and p in normal mode have different buffers.

批量注释

  1. Ctrl-vV 选中注释内容
  2. I 在行首插入 #//

其他技巧

  • Ctrl-o 只执行一次 normal mode 下的操作,然后返回 insert mode
  • ~ 切换大小写
  • . 重复上一次命令

Hexo

  • git clone 失败时尝试把校园网换成手机热点
  • 禁用 console 打印日志:更改 themes\redefine\scripts\events\welcome.js 文件