Vim multi-line comment and cancel

Source: Internet
Author: User

God operation

Writing code in vim often comes across multiple lines of comments and uncomment, and in VS we can use the default shortcut keys or customize shortcuts in settings to solve this problem.

Since Vim is so powerful, it must also have shortcut keys to complete. Here are the steps:

Step 1: In command line mode, place the cursor in the first column and press CTRL + V shortcut key to enter VB Visualization mode:

Step 2: Move the cursor up or down and select the line you want to comment on:

Step 3: After selecting, press * * Capital **i key to enter insert mode, enter the comment "//" or "#":

Note that you must press the I key in uppercase, lowercase is not possible. The landlord just started to press the lowercase I, the result has not been (laughter cry)

Step 4: Finally press the ESC key (two times), the selected lines have been commented out, Roar Kai Sen ~

Step 5: Repeat STEP1-STEP2 when canceling multiline comments, but at this point the cursor is checked and the number of lines is selected. Simply press the D key (lowercase) and the comment is deleted:

Note that this will be done by pressing the lowercase d and then all the rows you have selected are deleted by capitalization.

Of course, if you feel that these steps can't be remembered, you can click the link below in the. vimrc file China joins the relevant configuration, custom actions: Point me to me ~

The End

Vim multi-line comment and cancel

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.