晚上回来之后闲来无事,东翻翻西翻翻的,找到了之前下载的一篇《Vim tutorial》,发现了一些自己之前没怎么注意到的命令,值得学习,就此记录一下:
CTRL-F #向下翻一页
CTRL-B #向上翻一页
CTRL-D #向下翻半页
CTRL-U #向上翻半页
{ #Go to the beginning of current paragraph
} #Go to the beginning of next paragraph
( #Go to the beginning of previous sentence
) #Go to the beginning of next sentence
% #Jump to the matching {..} or (..)
w #Go to the beginning of next word
W #Go to the beginning of next WORD
e #Go to the end of current word
E #Go to the end of current WORD
b #Go to the beginning of previous word
B #Go to the beginning of previous WORD
0 #(zero) Go to the starting of current line
$ #(dollar) Go to the end of current line
H #Go to the first line of current screen
M #Go to the middle line of current screen
L #Go to the last line of current screen
zz #Redraw the screen with the current line under the cursor at the middle of the screen
:jumps #view the jump list
CTRL-O #Jump back to previous spot
CTRL-I #Jump forward to next spot
gf #Go to file(跳转至光标所在处文件)
CTRL-W gf #Go to file with open new tab
gg=G #format the entire buffer(格式化常用)
:g/PATTERN/d #Delete the line which has a specific pattern
:v/PATTERN/d #Delete the line which doesn’t has a specific pattern{非常有用}
:g/^$/,/./-j #Reduce multiple blank lines into a single blank line
:g/^/m0 #Reverse a file{将文件内容的所有行反转了,类似于tac命令}

有关vi(vim)的常用命令
https://mp.weixin.qq.com/s/zZAWpZbDtSFK6EROxaBRKw
https://www.vpser.net/manage/vi.html
学习 Vim 的命令行游戏
https://vim-adventures.com/
vim 使用宏实现批量骚操作[视频]
https://zhuanlan.zhihu.com/p/40804724
有哪些编程必备的 Vim 配置?
https://www.zhihu.com/question/19989337
学会了 Vim 还有必要用 GitHub Atom 或者 Sublime Text 吗?
https://www.zhihu.com/question/22904741/answer/23066711
用 Vim 写 Python 的最佳实践是什么?
https://www.zhihu.com/question/19655689
Vim 实用插件推荐(2017)
https://zhuanlan.zhihu.com/p/24742679
攻击者可通过恶意文件利用 Vim 漏洞执行任意命令
https://www.freebuf.com/articles/system/475531.html
`
开发者广泛使用的文本编辑器 Vim 近日曝出一个高危安全漏洞。该漏洞允许攻击者通过诱骗用户打开特制文件,直接执行任意操作系统命令。安全研究员 Hung Nguyen 发现,这一漏洞链揭示了应用程序处理嵌入式文件指令时存在的持续性风险。
# 广泛的攻击影响面
该漏洞的攻击面尤为广泛:modeline 功能在 Vim 中默认启用,且漏洞利用无需依赖次要的 modelineexpr 设置。此外,标准 Vim 构建默认包含 tabpanel 功能,这意味着大多数开箱即用的安装版本都易受此命令注入攻击。
# 修复建议
用户与系统管理员应立即更新软件。Vim 开发团队已修复缺失的安全检查机制,并在 GitHub 发布完整补丁。升级至 Vim 9.2.0272 或更高版本可彻底修复该漏洞,阻断沙箱逃逸途径。
`