Please ask two questions to improve the efficiency of using vim.
给我你的怀抱
给我你的怀抱 2017-05-16 16:41:13
0
3
616

1. How to search for multiple keywords at the same time
For example, I want to highlight all aa, bbbb, ccccc

in the document

2.Example
There is an enum

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, based on your answers and my own modifications, the method I use is as follows:

  1. set ve=all Allows the cursor to reach places without characters
  2. C-v Enter column block visual mode and select the column where you want to insert comments
  3. Press A and insert // 0, press Esc to return to normal mode
  4. VEnter line visual mode and select all lines with added comments
  5. Execute commandlet i=0|'<,'>g/0$/s//\=i/|let i=i+1
  6. set ve= Restore virtual editing options
给我你的怀抱
给我你的怀抱

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!