Multi-line comment (especially for python code) in the vim Compiler)
------------------------------------------------------ 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}