Using following test input:
***********
aaa
bbb
ccc
***********
ddd
eee
fff
-----------
ggg
hhh
iii
-----------
jjj
kkk
lll
-----------
***********
aaa
bbb
ccc
***********
ddd
eee
fff
-----------
Following method is close to what i'm looking for:
(i'm in need of using different ranges for each matches)
:execute 'g/ccc/-0,+0#' | execute 'g/eee/-1,+2#'
4 ccc <<----------- first returns lines with ccc, then with eee
21 ccc
6 ddd
7 eee
8 fff
9 -----------
23 ddd
24 eee
25 fff
26 -----------
Above output seems to show that the multiple global commands are executed sequentially. So, i get the "ccc" matches first from first global. Then comes the next set of matches from second global.
Is there way to run these global matches/commands on each lines in a single pass?
How would i go about getting following output instead?
4 ccc
6 ddd
7 eee
8 fff
9 -----------
21 ccc <<-----------
23 ddd
24 eee
25 fff
26 -----------