How can you replace one match with multiple instances of a character (like \t
)?
It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.
For example: I want to change
Items: item1 item2 item3 item4
to
Items:
item1
item2
...
and for the whitespace I want to use \t
tabstop (for example).
Something like:
:%s/\s\(item.\)/\r\t{5}\1/g
does not work.
\{5}
; unless you use\v
ery magic. (But that won't make it work in the replacement part, where you want to use it.)