Note that there are some explanatory texts on larger screens.

plurals
  1. POOpen a buffer as a vertical split in VIM
    primarykey
    data
    text
    <p>If you are editing a file in VIM and then you need to open an existing buffer (e.g. from your buffer list: <code>:buffers</code>) how can you open it in a vertical split?</p> <p>I know that you already can open it with a <em>normal</em> split like:</p> <pre><code>:sbuffer N </code></pre> <p>Wehere <code>N</code> is the buffer number you want, however, the above opens that <code>N</code> buffer horizontally, not vertically.</p> <p>I'm also aware that you can change the window placement after opening and have a Vertical Split like so:</p> <pre><code>Ctrl-W H Ctrl-W L </code></pre> <p>Which will vertically split the window to the right or the left.</p> <p>It seems to me that if there is a <code>sbuffer</code> there should be a <code>vsbuffer</code> but that doesn't exist (not that I am aware of)</p> <p>Also, please note that I am not looking for a plugin to solve this question. I know about a wealth of plugins that will allow you to do this.</p> <p>I am sure I might be missing something that is already there.</p> <p>EDIT: In the best spirit of collaboration, I have created a simple Function with a Mapping if someone else stumbles across this issue and do not want to install a plugin:</p> <p>Function:</p> <pre><code>" Vertical Split Buffer Function function VerticalSplitBuffer(buffer) execute "vert belowright sb" a:buffer endfunction </code></pre> <p>Mapping:</p> <pre><code>" Vertical Split Buffer Mapping command -nargs=1 Vbuffer call VerticalSplitBuffer(&lt;f-args&gt;) </code></pre> <p>This accomplishes the task of opening a buffer in a right split, so for buffer 1, you would call it like:</p> <pre><code>:Vbuffer 1 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload