How do I make vim substitute repeat until there are no more matches?
<p>I have a file with text that looks like </p>

<pre><code>{\o H}{\o e}{\o l}{\o l}{\o o} {\o W}{\o o}{\o r}{\o l}{\o d}
</code></pre>

<p>I want to make the text look like this</p>

<pre><code>{\o Hello} {\o World}
</code></pre>

<p>There are probably multiple tools I can use to solve this problem, but I am trying to use vim substitutions. So far, I have</p>

<pre><code>:%s/{\\o \(.\{-}\)}{\\o \(.\{-}\)}/{\\o \1\2}/g
</code></pre>

<p>The patterns here are</p>

<p><code>.\{-}</code> match some characters, non-greedy</p>

<p><code>{\\o .\{-}}</code> match the regex string <code>{\o .*}</code> but being non-greedy with the <code>.*</code></p>

<p>and <code>\( ... \)</code> creates the capture groups for backreferencing.</p>

<p>When I run this substitution once, I get </p>

<pre><code>{\o He}{\o ll}{\o o} {\o Wo}{\o rl}{\o d}
</code></pre>

<p>I <em>could</em> run this command two more times to get</p>

<pre><code>{\o Hell}{\o o} {\o Worl}{\o d}
</code></pre>

<p>and then</p>

<pre><code>{\o Hello} {\o World}
</code></pre>

<p>but I would really love if there was a way to do this with one command, i.e., to tell vim substitution to keep passing over the file until there are no more matches. It seems to me that this ought to be possible. </p>

<p>Does anyone know what magic I need to add to achieve this? It doesn't look like there's a flag that achieves this. Maybe some trick I don't know with labels?</p>