5.1:vi and Vim:
Vim is a text editing tool for all Linux systems, the same as with Windows Notepad, used to manipulate and edit files:
Vim is an upgraded version of VI, VIM (will display font color): VI (no color is displayed)
1, the installation of Vim :yum install-y vim-enhanced
2. Configuration file:
/ETC/VIMRC #全局配置文件
/HOME/.VIMRC #用户配置文件 (does not exist, needs to be established)
3, VIM can be divided into three modes: General Mode: Edit mode: Command mode: for example:
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/08/17c6896a3a994b7449f63470a2c354f4.jpg-wh_500x0-wm_3 -wmp_4-s_2873303419.jpg "title=" vim.jpg "alt=" 17c6896a3a994b7449f63470a2c354f4.jpg-wh_ "/>
4. Common Operation Commands:
Move cursor in general mode:
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/08/3441806740895d3291ea895a66e2d0b8.png-wh_500x0-wm_3 -wmp_4-s_963508096.png "title=" Vim2.png "alt=" 3441806740895d3291ea895a66e2d0b8.png-wh_ "/>
Cut Copy and paste in general mode:
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/08/af4d66625b48c74dca0b1c31fbcc1fd6.png-wh_500x0-wm_3 -wmp_4-s_1244476398.png "title=" Vim3.png "alt=" Af4d66625b48c74dca0b1c31fbcc1fd6.png-wh_ "/>
Edit mode: (enter the following command into edit mode): You can edit the contents of the file:
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/08/b01374da517f171ab6363e90608fab99.png-wh_500x0-wm_3 -wmp_4-s_2416377663.png "title=" Vim4.png "alt=" B01374da517f171ab6363e90608fab99.png-wh_ "/>
Command mode: (Press ESC to enter command mode),
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/08/7a1958a9ea87bd06120382c0d47b53e4.png-wh_500x0-wm_3 -wmp_4-s_277456583.png "title=" Vim5.png "alt=" 7a1958a9ea87bd06120382c0d47b53e4.png-wh_ "/>
Supplemental Command: in command mode
: Hi: Highlights are displayed:
: Nohi: The highlight is not displayed:
"X": Save exit, and Wq the difference is that when entering a file is not edited, the use of this command does not change the file's atime.
Command mode Replace command: We replace the size letter A with a lowercase letter a
[Email protected] ~]# cat 1.txt #输入文件的内容
Aaaaaaaaaaaaa
Aaaabbbbbbcc
Dddaacccacc
[Email protected] ~]# vim 1.txt
: 1, $s/a/a/g #用vim进入后 and then replaced with this command, the output is as follows:
[Email protected] ~]# cat 1.txt
Aaaaaaaaaaaaa
Aaaabbbbbbcc
Dddaacccacc
There are three alternative formats, depending on the situation:
[Email protected] Text original content @ Replace content @g
s# text original content # replace content #g
s/text original content/replace content/g
This article is from the "_de blog" blog, be sure to keep this source http://yuanhaohao.blog.51cto.com/7714752/1979804
day-Editor Vim