title: How do I swap the left hand and right hand sides of a C/C++ assignment statement in gvim?
body: <p>To be honest, I actually have a solution for this, but Google search finds so many great tips for me from this site, that I had to contribute something back. Here is what I came up with. For a single line: </p>
  
  <blockquote>
    <p>s/^\(\s\+\)\(.*\) = \(.*\);/\1\3 = \2;/</p>
  </blockquote>
  
  <p>For multiple lines starting at the current line, add <code>.,.+&lt;line count&gt;</code>.  For example:</p>
  
  <blockquote>
    <p>.,.+28s/^\(\s\+\)\(.*\) = \(.*\);/\1\3 = \2;/</p>
  </blockquote>
  
  <p>will substitute on the current line and the following 28 lines.  This should also work for Java and Perl.  For Python, omit the ending semicolon from the pattern and substitution (unless you're the sort who uses the optional semicolon).</p>
  
  <p>After typing all that, I find I do have a question.  Is there a way to simplify it so I don't have so many escape characters?</p>