I am trying to edit with two conditions in the vi.
example text)
hello world!
-apple watermelon
test text
two condition must be met.
I tried substitution via pipe in vi, but i cant
Expected
hello world!
-<b>a</b>pple <b>w<b>atermelon
test text
You can use
:g/^-/s#\<\(.\)#<b>\1</b>#g
Meaning:
-
(:g/^-/
)\<\(.\)
) (while capturing it)<b>\1</b>
(\1
referencing the captured value)g
flag, remove this unless :set gdefault?
returns nogdefault
)