Old boy Education Daily-May 9, 2017-vim command paste with # or comment Information format What if there's a mess?

Source: Internet
Author: User

1. Topics

Old boy Education Daily-May 9, 2017-vim editor uses knowledge points:
Vim command paste with # or comment Information format will be confusing, what method to solve?
Problem Description:
Each time the code is copied, if the code contains//or # Such comments are easy to let the format out of order, the content displayed is not neat, not the desired display format.

2. Reference answer reason analysis:

is due to the automatic indentation of the vim Edit command, so you can suppress automatic indentation when pasting code with comments

Problem solving:

Vim is automatically indented when pasting the code, making the code mess, and maybe even because a comment on a line causes the code to be commented out, the initial solution is: Use VI to open the file and paste it up, but in fact, the Vim editor can be set to modify.

Vim oldboy.txt #<--Edit a file: Set paste #<--in Vim's command line mode input, turn off vim indent function

Description: Then into the insert mode paste, the code will not be automatically indented, you can hit the code when you need to automatically indent, so you need to change back

: Set Nopaste #<--turn on vim indent function

A convenient way is to modify the. VIMRC configuration file in the user's home directory:

Set pastetoggle=<f9>

Description
Later in insert mode, you can quickly toggle Auto Indent mode by pressing the F9 key.

3. Statistical information

Today is the 46th Day of the day to accompany you and look forward to your progress .

For questions and answers, please leave a comment in the blog comments section .
Index of the topic of the previous period

http://lidao.blog.51cto.com/3388056/1914205

This article is from the "Lee blog" blog, make sure to keep this source http://lidao.blog.51cto.com/3388056/1923845

Old boy Education Daily-May 9, 2017-vim command paste with # or comment Information format What if there's a mess?

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.