title: Execute a command within Vim from the command line
body: <p>Is there a way to execute a Vim command on a file from the command line?</p>
  <p>I know the opposite is true like this:</p>
  <pre><code>:!python %
  </code></pre>
  <p>But what if I wanted to <code>:retab</code> a file without opening it in Vim? For example:</p>
  <pre><code>&gt; vim myfile.c
  :retab | wq
  </code></pre>
  <p>This will open myfile.c, replace the tabs with spaces, and then save and close. I'd like to chain this sequence together to a single command somehow.</p>
  <p>It would be something like this:</p>
  <pre><code>&gt; vim myfile.c retab | wq
  </code></pre>