Vim edit the general operation of the file
1. Vim #在命令行中输入vim, enter the VIM editor
2. I #按一下i键, the lower end of the display--insert--#插入命令, in Vim may have any character function
3. ESC #退出i (Insert) command for other commands to use
4.: r filename #读入一个文件内容 and written to the current editor
5.: w newfilename #将该编辑器中的内容写入到一个新文件中
6.: w #在编辑的过程中保存文件, equivalent to ctrl+s in Word
7.:! Command temporarily leaves VI to command column mode to perform command display results! Example:!ls #在编辑过程中执行shell命令ls
8.: Sh #进入shell命令行, after executing the command ctrl+d exit re-enter VIM edit continue edit under shell command, execute ctral+l complete clear screen
9.: Wq #保存文件并退出
Ten. ZZ #保存文件并退出, with the previous command, pay attention to uppercase
One.: q! #强制退出, do not save
: Set number or: Set Nu #使编辑中的文件显示行号
: Set Nonumber or: Set Nonu #与上一条命令相反, line numbers are not displayed
.: Help I #查看插入命令帮助
. U #撤消上一步操作
/fedora #查找Fedora字符
.: S/fedora/redhat #将Fedora字符替换为Redhat (replace only the line where the cursor is located)
DW #删除单词 DD #删除行
o #打开空白一行
Vim + filename #进行文件最后一行进行编辑
Vim +n filename #进入文件第n行进行编辑
The.: 1,.s/redhat/fedora # Indicates the current line, which is the line #将第1行到当前行 (.) of the cursor. The first occurrence of the redhat character instead of the Fedora
.: 1,.s/redhat/fedora/g #将第1行到当前行 (.) All occurrences of the redhat character instead of the FEDORA,G global flag
.: 1, $s/redhat/fedora/g #$ represents the last line #将第1行到最后一行所有出现的redhat字符代替为fedora
%s/redhat/fedora/g.: #同上一个命令
%s/\/fedora/g: #将第1行到最后一行所有出现的redhat字代替为fedora #字 instead of characters
: F #显示文件内容, status, etc. #同ctrl +g command
e!.: #当前文件, return to last saved: E file #切换编辑文件
: n #当编辑时有多个文件 (e.g. vim file1 file2) switch to the next file, in conjunction with: E file
Ubuntu 14.04 Vim Edit the general operation of the file