Vi/vim multiple lines of comment, uncomment

Source: Internet
Author: User

After Vim opens the file, press CTRL + V to enter "VISUAL BLOCK" mode

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 ://s2.51cto.com/wyfs02/m00/86/2a/wkiom1e2pxeiht6laaagbf17zxa065.jpg "title=" 1.jpg "alt=" Wkiom1e2pxeiht6laaagbf17zxa065.jpg "/>

Then press the arrow keys to select the line you want to add a comment to

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 ://s2.51cto.com/wyfs02/m01/86/2a/wkiol1e2pzhxn0g1aaap4wf8a8o250.jpg "title=" 2.jpg "alt=" Wkiol1e2pzhxn0g1aaap4wf8a8o250.jpg "/>

Then press the capital letter I

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 ://s4.51cto.com/wyfs02/m02/86/2a/wkiol1e2p0ndnacbaaaylghaevm489.jpg "title=" 3.jpg "alt=" Wkiol1e2p0ndnacbaaaylghaevm489.jpg "/>

Insert mode appears

Now you can insert characters, including inserting comment characters #

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 ://s3.51cto.com/wyfs02/m01/86/2a/wkiom1e2p2wrvrysaaazwyk51ns008.jpg "title=" 4.jpg "alt=" Wkiom1e2p2wrvrysaaazwyk51ns008.jpg "/>

This time only changes the contents of a row, after the change is completed, press ESC to exit the Insert mode will not take effect on each selected line

-------------------------------------------------------------------------------------------


Delete Comment, enter--VISUAL BLOCK--mode to select the row to manipulate, press X directly to delete a 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= "http ://s2.51cto.com/wyfs02/m00/86/2a/wkiol1e2p37sa_xxaaakvnn97ak675.jpg "title=" 5.jpg "alt=" wKioL1e2p37SA_ Xxaaakvnn97ak675.jpg "/>

If you want to delete more than one character, you need to first select the row you want to manipulate, and then press the RIGHT ARROW key to select multiple characters

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 ://s5.51cto.com/wyfs02/m02/86/2a/wkiol1e2p5itwaezaaaxiafv8ji852.jpg "title=" 6.jpg "alt=" Wkiol1e2p5itwaezaaaxiafv8ji852.jpg "/>

Select OK and press X to delete selected characters


This article from "Ronin" blog, reproduced please contact the author!

Vi/vim Multi-line comments, uncomment

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.