5.1 Vim Introduction
1) Vim is the upgrade version of VI, with color display, also divided into general mode, editing mode, command line mode;
<yum install-y vim-enhanced> Installation Instruction pack, install only one
< yum install-y vim> This method installs multiple VIM-related packages
<vim/etc/passwd> How to use--edit password file
2) < cp/etc/passwd/tmp/> copy to TMP under VIM Open found no color,
Because a particular file is recognized in a specific directory, and the color is related to the file name and content.
3) operation of General mode
Move the cursor operation, all operations can be added n operation.
NH cursor moves n characters to the left
n Space cursor moves n characters to the right
X Delete one character
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "spacer.gif"/> 650) this.width=650; "Src=" Https://s4.51cto.com/wyfs02/M00/A4/6A/wKioL1mqn_iSNkxmAASOy59PWac691.png-wh_500x0-wm_3-wmp_4-s_2299746581.png " Title= "111111111.png" alt= "Wkiol1mqn_isnkxmaasoy59pwac691.png-wh_50"/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/05/B9/wKiom1mqoEODO5nOAAPuhCVn6xM574.png-wh_500x0-wm_ 3-wmp_4-s_732508628.png "title=" 22222222.png "alt=" Wkiom1mqoeodo5noaapuhcvn6xm574.png-wh_50 "/>
4) Edit mode
I enter edit mode
I Enter edit mode from the beginning of the line
O Enter edit mode from the beginning of the next line
O Enter edit mode from the beginning of the previous line
A enter edit mode after the character
A Enter edit mode from the end of the line
U Restore previous action (ESC first)
5) Command mode
/word search for words after the cursor
n Search down,,, shift+n up,,,
? Word cursor before searching for words
1,100s/word1/word2/g replaces 1-100 rows of word1 with Word2 without G only replacing the first
1, $s/word1/word2/g replace all
1, $s #word1#word2/g when word1 and Word2 contain/use # or @ symbol
wq! Force Save exit
Set NU Display line number
Set Nonu does not display line numbers
Nohl not highlighted
X If the file change is equivalent to Wq will change the mtime, if not change the file is also equivalent to WQ, but will not change mtime
6) Practical Operation
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "spacer.gif"/> 650) this.width=650; "Src=" http S://s3.51cto.com/wyfs02/m00/05/b9/wkiom1mqofjhdmtmaaptjhrpg6m460.png-wh_500x0-wm_3-wmp_4-s_2701808393.png " Title= "33333333.png" alt= "Wkiom1mqofjhdmtmaaptjhrpg6m460.png-wh_50"/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/A4/6B/wKioL1mqoE_yQN97AAUsrzqdb7w553.png-wh_500x0-wm_ 3-wmp_4-s_1149870980.png "title=" 4444444.png "alt=" Wkiol1mqoe_yqn97aausrzqdb7w553.png-wh_50 "/>
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/05/B9/wKiom1mqoHeBckRiAAVMXDdKJvU923.png-wh_500x0-wm_ 3-wmp_4-s_1205110412.png "title=" 5555555.png "alt=" Wkiom1mqohebckriaavmxddkjvu923.png-wh_50 "/>
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
This article is from "Malt's Sky" blog, be sure to keep this source http://iammalt.blog.51cto.com/12054231/1962178
Learn Linux fifth with Amin vim tool