Solve the problem that paste in vi/vim will have more indentation and spaces at the beginning of the line.

Source: Internet
Author: User
SecureCRT will send your original text to the server in a string style. So when vim on your server is set to autoindent, in I mode, it will indent the strings transmitted by secureCRT. If the copied text contains spaces or tabs that indicate indentation, it will also be indented as a string.
Solution:
1. Input: set paste before copying (in this case, vim will not start automatic indent, but just copy and paste it)
2. After the copy is complete, enter: set nopaste (disable paste)

Paste knowledge
'Paste 'Boolean (disabled by default)
Global
{Vi does not have this function}
Switch Vim to the paste mode. It can be used to cut or copy text from a window and paste it to Vim. It
To avoid unexpected results.
Set this option to run Vim on the terminal, because Vim cannot distinguish the input and pasted files.
. In the GUI, Vim knows who is from pasting, even if 'paste 'is not enabled, it basically does not do
Error. This is also true for the terminal where Vim can handle mouse clicks by itself.
Reset this option when you start the GUI. So if you set it in. vimrc, you can make it in the terminal
Work, but not in the GUI. Setting 'paste 'in the GUI has the following side effects: for example, paste job
The column button cannot work in insert mode because it uses ing.
When the 'paste 'option is enabled (including the one that is originally opened ):
-Shield the ing between the insert mode and the command line mode.
-Shield abbreviations
-Set 'textidth' to 0.
-Set 'wrapmargin 'to 0.
-'Autoindent 'is reset.
-'Smartindent 'is reset.
-'Softtabstop' is set to 0.
-"Revins" is reset.
-'Rsequence' is reset.
-'Showmatch' is reset.
-The usage of 'formatoptions' is the same as if it is null.
The following options keep the original values but do not have the actual effect:
-'Lisp'
-'Indentextpr'
-'Cindent'
Note: When the 'paste 'option is enabled, if you start to edit other files, the mode line or automatic command can
These settings can be changed again, causing trouble when pasting text. At this time, you may need to reset
Bit 'paste.
When the 'paste 'option is reset, the options mentioned above are restored to the settings of the last 'paste' from off to on
. Resetting 'paste 'before 'paste' has no effect. Because 'paste 'is not activated
You can use ing. The 'pastetoggl' option can be used to specify the hotkey for switching the 'paste 'option.

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.