Key operation:
Note: Ctrl + V enters column edit mode, moves the cursor down or up, marks the beginning of the line that needs comment, then presses the uppercase I, then inserts the comment, such as "#", and then presses ESC, which is all commented.
Delete: Press v First, enter visual mode, select the number of columns in the landscape (such as "#" comment symbol, need to select two columns), then press ESC, then press CTRL + V to enter the column editing mode, move the cursor down or up, select the comment section, and then press D to delete the note symbol (#).
PS: Of course, it is not necessarily the shell's annotation "#", it can be "//", or any other character; Vim does not know what is an annotation, all characters.
Use the Replace command:
:% s/^/\/\//g Add//Number comment at the beginning of all content
: 2,50 s/^/\/\//g Add//Number comment at the beginning of 2~50
: 2,50 s/^\/\///g Delete//number at the beginning of 2~50
Replace blank line:
: 1, $s/^$\n//g
Line capital of each row adds a string:%s/^/the string to insert
Add a string to the end of each line:%s/$/the string to insert
Explain:
% represents subsequent actions on each line of the edited file
$ represents the end of a line
^ Represents the beginning of a line
Note: The column reproduced from ZXX
Vim text Some line comment, replace