Multi-line comment (especially for python code) in the vim compiler, vimpython

Source: Internet
Author: User

Multi-line comment (especially for python code) in the vim compiler, vimpython

------------------------------------------------------ Multiline comments in the vim compiler --------------------------------------------------------

When writing a python program using the vim command, it is troublesome to write multiple lines of comments. Because python does not use/* xxxx */as the C language to annotate multiple lines, only # Can Be Used to annotate each line. If there are hundreds of lines, when should it be annotated. In addition to a line of honest comments, I would like to share several methods here:

First, use 'xxx' to comment out the content to be annotated as a string. However, this method is not recommended.

Type 2: place the content to be annotated with a function. If you do not call this function, the content to be annotated will be useless. This is better than the first one.

Third: I recommend this and share it with you.

There are several steps:

Ctrl + v; view mode in vim, select the content to be commented

Shift + I; insert characters

Shift + #; insert # to the front of the row to be annotated (displayed in the first row)

Esc; Press Esc twice at least, then all the selected rows will be added before it #

The third method is not only useful for multi-line comments of python code, but also useful for multi-line comments of programs in other languages.


------------------------------------------------------------ Shell multi-command line operations ------------------------------------------------------

For example, if you want to restart all openstack-nova-* services, it is too troublesome to start them one by one. You can also write a script to start them. But it can be started directly with commands (which is also operated by colleagues)

For item in 'ls | grep' openstack-nova-* ''; do service $ item restart; done

There is also a Backup command: cp test. py {,. bak}

Address: http://blog.csdn.net/yuzhihui_no1/article/details/41747655

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.