Method: 1. Press esc to enter command line mode; 2. Press "Ctrl v" to enter column mode; 3. Press "PgUp/PgDn" to select the line to be commented; 4. Press capital i Enter insert mode; 5. Enter the comment character "//" or "#"; 6. Press the esc key to save.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
1. Multi-line comments:
1. First press esc to enter the command line mode, and press Ctrl v, enter column (also called block) mode;
2. Use the up and down keys at the beginning of the line to select multiple lines that need to be commented;
3. Press the keyboard (capital) "I" key to enter insert mode;
4. Then enter the comment character ("//", "#", etc.);
5. Finally press the "Esc" key.
Note: After pressing the esc key, it will take a while for the comments to appear. Don’t worry~~The time is very short
2. Delete multi-line comments:
1. First press esc to enter the command line mode, then press Ctrl v to enter the column mode;
2. Select the multiple lines to be uncommented;
3. Press "x" or "d".
Note: If it is a "//" comment, you need to perform this operation twice. If it is a "#" comment, just once.
3. Delete multiple lines
1. First, in the command mode, enter ":set nu" to display the line number;
2. Determine by line number The line you want to delete;
3. Enter the command ":32,65d" and press the Enter key. Lines 32-65 will be deleted. It is very quick.
If you accidentally delete the wrong , you can use the 'u' key to restore (in command mode)
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to make multi-line comments in Linux. For more information, please follow other related articles on the PHP Chinese website!