vim常用命令小结

插入

i insert
a 光标后插入
o 当前行后插入新行
O 当前行前插入新行

删除

dd 删行

拷贝

yy 拷贝当前行
y$ copy to end of line

剪切

D cut to end ot line

粘贴

p 粘贴

移动

hjkl

0 行头
^ 非空白行头
gg beginning of file
b beginning of word
w W word

$ 行尾
g 空白符行尾
L end of file
e E word end

:n 到第N行
n|column n
[[ function start
[{ block start

组合

oy$ 先移到行头,从这里开始拷贝,拷贝到行末
y2/foo 拷贝两个foo之间的字符串

退出

esc normal
:wq zz 存盘 退出

其他

. n 重复某命令n次

`