1、输入模式与命令模式的切换
按 [Esc]键 切换到 命令模式;
2、保存与退出
:w mytest.txt 保存文件名
:q 退出
:q! 强制退出
:wq 保存并退出
3、插入文本命令
i 在光标前
I 在当前行首
a 光标后
A 在当前行尾
4、删除命令
x 删除当前光标所在的字符
dd 删除当前整行
5、搜索命令
/pattern 从光标开始处向文件尾搜索pattern
?pattern 从光标开始处向文件首搜索pattern
n 在同一方向重复上一次搜索命令
N 在反方向上重复上一次搜索命令
6、屏幕操作命令
Ctrl+f: 向文件尾翻一屏
Ctrl+b: 向文件首翻一屏
显示行号 :set nu
取消:set nonu
7、高亮显示命令
高亮显示 set hlsearch
取消高亮显示 set nohlsearch