Vim replication code contains comments when the format will be messy solution

Source: Internet
Author: User
Tags comments
Each time you copy the code, if the code has//such comments are easy to let the format out of the way, the following settings can be avoided this situation.

Cancel Auto indent when pasting code

Vim in the paste code will be automatically indented, the code to make a mess, and maybe even because of a line of comments caused by the subsequent code is all commented out, I know that a classmate this time will use VI to open the file and paste it up (I was like this before), in fact, need to set up the first

Set paste

Then paste into insert mode, and the code will not be automatically indented. But the code needs to be automatically indented, but also to change back:

Set Nopaste

The most convenient way is to add a sentence in the. VIMRC: Set pastetoggle=<f9>

Later in insert mode, you can toggle auto indent by pressing the F9 key.

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.