Vim Usage Tips

Source: Internet
Author: User



1. Under Vim paste a large piece of Python code, but from a line start all more back a tab, there are more than 100 lines, one by one, I manually adjusted, tired half dead.

Solution:

In Vim, it's best to go to paste mode before pasting the code, which turns off auto indent

Set paste

Paste the code in and then close paste mode

Set Nopaste


Ps:vim cannot know that you are pasting (non-GUI version, no mouse support is turned on in the terminal or the terminal itself does not support the mouse,

Because VIM does not have X Clipboard support to bypass Vim, use the Shift key method to paste the terminal directly

(such as when Vim is pasted into SSH, it is usually

Vim does not have access to the local clipboard, so the terminal can only "type"),

Then you need to set the ' paste ' option before pasting. This option disables automatic indenting, mapping, and so on in insert mode




2. How the Zone indents:

A. Ctrl + v selected, then shift +i, enter a space or tab, and finally ESC

B.

:10,100>

Line 10th to 100th indent

:20,80<

Line 20th to 80th anti-indent


C.

Indent a single line code is two greater than sign ' >> '

Retraction is two less than sign ' << '

If you want to indent a lot of lines of code, do it as follows

Press ' V ' to enter selection mode here

Aaaaaaaaaaaaa

bbbbbbbbbbbbbbb

Ccccccccccc

Ddddddddddd

Move the cursor here, press once greater than > ' indent once, press ' 6> ' indent six times, press ' < ' to retract. The following same


Vim Usage Tips

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.