Solve the problem of confusing format when Vim is pasted

Source: Internet
Author: User

When Vim is pasted, the formatting problem is caused by indentation.

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

Original: http://www.cnblogs.com/softwaretesting/archive/2011/09/20/2182177.html

If you set the auto indent set autoindent in. VIMRC, when you paste the code in insert mode, VIM automatically indents the code, resulting in a confusing format. The solution is as follows

Setting the set paste option in. VIMRC does not cause indentation when pasting the code, but changes the option back to set Nopaste if indentation is required. It's a hassle to change, so you can set a switch.

Set Pastetoggle <F9>

So, you can turn the paste option on and off by pressing the F9 key, press F9 before pasting, and then press F9 when you need to indent.

The default tab in Vim contains 8 spaces, if you prefer the 4-space mode, add the following options

Set Tabstop=8

Solve the problem of confusing format when Vim is pasted

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.