Vim Editor-Multiple lines with comments and comments

Source: Internet
Author: User
When using the Vim editor, it is sometimes necessary to annotate or annotate multiple lines of code, unlike we need to enter our own command operations, as in the case of VS, and two methods are described below. Method One: Block selection mode 1. Insert Note (1) First press ESC on the keyboard to enter the command line mode (2) and press CTRL + V to enter the visual block mode (3) Use the next key to adjust the number of lines to comment and the width of the line (4) and then press Shift+i or S into insert mode (5) to enter the symbol for the comment, such as # (6) Press ESC again, then you can complete multiple lines of comments (may need to wait a while, do not worry) 2. Go to comment The first three steps are the same as the comment. (1) First press ESC on the keyboard to enter the command line mode (2) and press CTRL + V to enter the visual Block Mode (3) using the next key adjustment needs to comment on how many lines and the width of the line (4) and then press D to complete the annotation method two: Replace the command 1. Insert Note (1) First press ESC on the keyboard to enter command line mode (2) and enter the following command on the bottom line: Start line number, end line number s/^/ /g before inserting comments: After inserting comments: The bottom row shows a total of a few lines inserted in Note 2. Go to comment (1) First press ESC on the keyboard to enter the command line mode (2) and enter the following command on the bottom line: Start line number, end line number s/^ comment// G to comment before: After the comment: After removing the comment, the bottom line shows that a few lines of comments are removed altogether

Vim Editor-Multiple lines with comments and comments

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.