Vim/vi of Linux text editing

Source: Internet
Author: User

Today on the Internet to see a article about Vim feel great, just record down to learn!


VIM/VI Introduction


Vim/vi is a powerful full-screen text editor, which is the most commonly used text editor on Linux/unix, and its role is to create, edit, and display text files.

1. Create a command, create a file such as #vi filename, enter command mode

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/0A/wKiom1c1PZTDHM-zAAD59NTT1vk084.png "style=" float: none; "title=" 1.png "alt=" Wkiom1c1pztdhm-zaad59ntt1vk084.png "/>

2, insert the command, you can edit the file


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/07/wKioL1c1Pneg9HK_AAC0iy9iTQ4655.png "style=" float: none; "title=" 2.png "alt=" Wkiol1c1pneg9hk_aac0iy9itq4655.png "/>

3, locate the command, you can locate the required location of this file

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/0A/wKiom1c1PZeBD_5SAAD6b28bhKA720.png "style=" float: none; "title=" 3.png "alt=" Wkiom1c1pzebd_5saad6b28bhka720.png "/>


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/07/wKioL1c1PnniF73-AACkrO_Vwwo914.png "style=" float: none; "title=" 4.png "alt=" Wkiol1c1pnnif73-aackro_vwwo914.png "/>

4, delete the command, you can delete or cut some text

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/80/0A/wKiom1c1PZniw96UAADhnCY7KWI240.png "style=" float: none; "title=" 5.png "alt=" Wkiom1c1pzniw96uaadhncy7kwi240.png "/>

5. Copy Cut command

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/07/wKioL1c1PnvjHK_TAADAwa000QQ592.png "style=" float: none; "title=" 6.png "alt=" Wkiol1c1pnvjhk_taadawa000qq592.png "/>

7. Replace or Cancel commands

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/07/wKioL1c1PnzSRA-xAACWxl-j2LA103.png "style=" float: none; "title=" 7.png "alt=" Wkiol1c1pnzsra-xaacwxl-j2la103.png "/>

8. Search and Replace commands

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/0A/wKiom1c1PZuxzl1HAAECv6J23Ew399.png "style=" float: none; "title=" 8.png "alt=" Wkiom1c1pzuxzl1haaecv6j23ew399.png "/>

: 10,100s/ircu/ircu/g (do not ask for replacement)
: 10,100s/ircu/ircu/c (ask to replace)

9. Save and Exit commands

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/07/wKioL1c1QS3j8BpHAADnEAGed7U607.png "title=" 10.png "alt=" Wkiol1c1qs3j8bphaadneaged7u607.png "/>

10. Common examples

(1) Import file: R file name

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/0A/wKiom1c1Qr7j6CaLAAAe7VTU2rw725.png "style=" float: none; "title=" 11.png "alt=" Wkiom1c1qr7j6calaaae7vtu2rw725.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/80/07/wKioL1c1Q6HyUWPmAAAeyp_WvGQ449.png "style=" float: none; "title=" 12.png "alt=" Wkiol1c1q6hyuwpmaaaeyp_wvgq449.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/0A/wKiom1c1Qr-Cv6NeAABIDZX3Si8829.png "style=" float: none; "title=" 13.png "alt=" Wkiom1c1qr-cv6neaabidzx3si8829.png "/>

< Span style= "Color:rgb (51,51,51); font-family: ' The song Body '; Font-size:14px;line-height:28px;background-color:rgb ( 249,249,249); " > (2) Execute command  :r ! command   such as: R!date

(3) import command execution result: R! Command, the first two are used together.

(4)define shortcut keys: Map shortcut Trigger command
Example:: Map ^p i#<esc> such as : Map ^b 0x
^p = ctrl+v,ctrl+p = Ctrl+v+p

< Span style= "Color:rgb (51,51,51); font-family: ' The song Body '; Font-size:14px;line-height:28px;background-color:rgb ( 249,249,249); " > (5) continuous line Note  :n1,n2s/^/#/g

< Span style= "Color:rgb (51,51,51); font-family: ' The song Body '; Font-size:14px;line-height:28px;background-color:rgb ( 249,249,249); " >& Nbsp;   :n1,n2s/^#//g   Remove the beginning of the line comment

< Span style= "Color:rgb (51,51,51); font-family: ' The song Body '; Font-size:14px;line-height:28px;background-color:rgb ( 249,249,249); " >& Nbsp;   :n1,n2s/^/\/\//g

(6) replacement: AB 51blog redking.blog.51cto.com

Cancel Replacement Unab 51blog



Vim/vi of Linux text editing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.