Vim Programming Common commands

Source: Internet
Author: User

1. Full-text coverage

After the program is published to the test and development environment, it is often necessary to telnet to the Linux change code. Usually in the IDE, CTRL + A, CTRL + V to cover the entire document, you need to do this in vim

Vim filename

GG-Jumps to the first line (the cursor does not have to be executed when the first row is default)
V--Enter visual mode
G--Jump to the last line
D--Delete all rows selected (you can continue this command if not all deleted)

    • Java files

When Vim pastes Java code, it is sometimes automatically indented, resulting in a confusing code format and the solution is as follows.

  1. Cancel Auto Indent
    In command mode, use ": Set Nosmartindent" and ": Set Noautoindent" To cancel Auto indent and then paste again. After the completion of the automatic indentation ": Set Smartindent" and ": Set Autoindent", the above commands can be used shorthand, such as ": Set Si", can be the help of vim ": Helps Smartindent" to see the corresponding instructions.

  2. Paste Mode
    Vim's editing mode, there is also a paste mode, in this mode, you can paste the original text into vim, to avoid some formatting errors. Enter and exit the mode with ": Set Paste" and ": Set Nopaste". A more convenient way is to set a shortcut to enter and exit paste mode in Vim, add a line to "~/.VIMRC" to configure "set pastetoggle=<f12>", so that the F12 can be quickly switched in paste mode, Of course, shortcut keys can be arbitrarily specified without conflict, specifically how to specify, refer to the accompanying tutorial links.

Referenced from: Vim is indented when pasting code into confusion

Vim Programming Common commands

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.