VIM Sticky code format confusing solution

Source: Internet
Author: User

Thank you for the article of the Ox. It solves the problem that I have a headache with vim. When VIM creates a new file, the sticky code is automatically indented, resulting in a very confusing format. According to Blogger's experience, in/etc/vim, modify VIMRC, add set pastetoggle=<f9> before pasting code, enter insert mode, press F9, you can turn off automatic indentation. When you need your own handwriting code, enter insert mode, the default is automatically indented. ===== VIM The format is broken when the copy code contains comments

Each time you copy code, if the code has//such comments can easily let the format out of chaos, through the following settings to avoid this situation.

Cancel automatic indentation when pasting code

Vim automatically indents the code when it is pasted, make a mess of the code, maybe even because a comment on a line caused by the following code is all commented out, I know there are students this time will use VI to open the file and paste it up (this is what I used to be), in fact, need to set up first

Set paste

Then go into insert mode and paste, the code will not be automatically indented. But when you need to automatically indent code, you have to change back:

Set Nopaste

The easiest way to do this is to add a sentence to the. VIMRC: set pastetoggle=<f9>

Later in the Insert mode, you can toggle the automatic indentation by pressing the F9 key.

Http://hi.baidu.com/hellosim/blog/item/a7b165151089fae8c3ce798b.html

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.