I want to extract multiple occurences of some text that spans multiple lines and can be matched with a single Vim regex (using meta character
\_). Unfortunately, althouth the matching lines are properly highlighted in Vim, when I add any Vim command (like delete or yank) after the matching regexp, the command only works on the first line of each match.
1: bad_function(arg1, 2: arg2, arg3, 3: ... 4: argN); 5: good_function(); 6: ... 7: bad_function(arg2_1, 8: ... 9: arg2_N); 10: another_good_function();
If I execute
:g/bad_function([^;]\+\_[^;]\+;$/d, then only lines 1 and 7 get deleted although highlighted are lines 1-4 and 7-9.
How to yank/delete all the matched (highlighted) lines?
:let @a='' :g/first\_.*second.*$/normal! v/second^M$"Ay
^M with CTRL-V then Enter.