Automating substitute expressions in vim
<p>What is a good way to automate substitute commands in vim?</p>

<p>Suppose I have something like:</p>

<pre><code>s/foo/bar/g
</code></pre>

<p>except much more complex and I want to run it on selected ranges without 
having to type the substitute command?</p>

<p>How can I save the substitute command and give it short convenient name that I can invoke it by?</p>