title: VIM open c++ header file in vertical split by combining three commands
body: <p>I have indexed my c++ codebase with ctags, I can open a header file as follows:</p>
  
  <pre><code>:tag myfile.h
  </code></pre>
  
  <p>(It doesn't matter where myfile.h is located, as long as it is inside the indexed codebase it will open correctly in vim)</p>
  
  <p>When I'm editing a c++ file, I can get the header filename as follows:</p>
  
  <pre><code>:e%&lt;.h
  </code></pre>
  
  <p>e.g. when editing myfile.cpp, executing this command will display myfile.h on the command line.</p>
  
  <p>A file can be opened in vertical split, by issuing: </p>
  
  <pre><code>:vs &lt;myfile&gt;
  </code></pre>
  
  <p><strong>Now what I want to accomplish, is to have 1 command or function which I can use to open a header file of the corresponding c++ file that I'm currently editing in vertical split. Hence basically I want to combine the 3 above commands as if I would be doing a Unix pipe, e.g.:</strong></p>
  
  <pre><code>:vs tag | e%&lt;.h
  
  " :vs     to open file in vertical split
  " :tag    to find tag
  " :e%&lt;.h  to get header filename
  </code></pre>
  
  <p>Obviously the Unix pipe doesn't work on vim, alternatively I've tried to write a function at which I assign the result of a command to a variable, e.g.</p>
  
  <pre><code>headerFileName = :e%&lt;.h
  </code></pre>
  
  <p>Which apparently is not the correct way of doing this, I'm a bit lost here so I hope somebody can provide some help.</p>