Ubuntu without update source is no way to use Vim commands can only be used Vi command will record all my down
vi / vim command:
Inserts:
i: 插入光标前一个字符
I: 插入行首
a: 插入光标后一个字符
A: 插入行未
o: 向下新开一行,插入行首
O: 向上新开一行,插入行首
Move the cursor:
h: 左移
j: 下移
k: 上移
l: 右移 M: 光标移动到屏幕中间行 L: 光标移动到屏幕最后一行行首 G: 移动到指定行,行号 -G w: 向后一次移动一个字 b: 向前一次移动一个字 {: 按段移动,上移 }: 按段移动,下移 Ctrl+d: 向下翻半屏 Ctrl+u: 向上翻半屏 Ctrl+f: 向下翻一屏 Ctrl+b: 向上翻一屏 gg: 光标移动文件开头 G: 光标移动到文件末尾
Delete command:
x: 删除光标后一个字符,相当于 Del
X: 删除光标前一个字符,相当于 Backspace
dd: 删除光标所在行,n dd 删除指定的行数
D: 删除光标后本行所有内容,包含光标所在字符 d0: 删除光标前本行所有内容,不包含光标所在字符 dw: 删除光标开始位置的字,包含光标所在字符
Undo command:
u: 一步一步撤销
Ctrl+r: 反撤销
Repeat the command:
.: 重复上一次操作的命令
Mobile line of text:
>>: 文本行右移
<<: 文本行左移
copy and paste:
yy: 复制当前行,n yy 复制 n 行
p: 在光标所在位置向下新开辟一行,粘贴
Visual mode:
v: 按字符移动,选中文本
V: 按行移动,选中文本可视模式可以配合 d, y, >>, << 实现对文本块的删除,复制,左右移动
Replace operation:
r: 替换当前字符
R: 替换当前行光标后的字符
Find command:
/: str查找
n: 下一个 N:上一个
VI / VIM line numbers:
Need enabled:
In command line mode input vim: set nu Cancel Display: vim input at the command line: set nonu
Permanent Auto Show:
Terminal: vim ~ / .vimrc open an empty file, add set nu, save and exit and restart vi / vim.