1. How to find multiple keywords at the same time
For example, I want to highlight all aa, bbbb, ccccc in the document
2. Examples
There is an enumeration
enum Test {
TEST_A,
TEST_BBBBB,
TEST_CC,
TEST_DDDDDDD,
TEST_EEE
};
How to quickly add the following comments
enum Test {
TEST_A, // 0
TEST_BBBBB, // 1
TEST_CC, // 2
TEST_DDDDDDD, // 3
TEST_EEE // 4
};
For question 2, combining your answers with my own modifications, I used the following method:
-
set ve=all
So that the cursor can reach a place without characters -
C-v
Enter the column block visual mode and select the column to insert comments into - Press
A
And insert// 0
, pressEsc
Return to normal mode -
V
In line visual mode, select all lines to which comments have been added. - executive command
let i=0|'<,'>g/0$/s//\=i/|let i=i+1
-
set ve=
Restore virtual editing options
Second question:
set ve=all
So that the cursor can reach a place without charactersC-v
Enter the column block visual mode and select the column to insert comments into- Press
A
And insert// 0
, pressEsc
Return to normal mode- Enter the column block visual mode again and select which column
0
- UsevisIncr.vimThe command of
:I
Change it to an increasing numerical sequenceset ve=
Restore the virtual editing options (I recommend using non-default valuesblock
, so you don’t have to switch frequently)PS: Is it generally expressed by integers that cannot be enumerated?