How to split existing buffer vertically in vim?

Solution 1:

The vs and vsplit commands take a filename as an argument like :vs somefile to open a file in a vertical split.

To put an existing buffer in a split window you use the sb# command (where # is the buffer number). Splits in VIM default to horizontal, to change this, prefix your command with vert which forces a vertical split of the next split command.

:vert sb#

Where # is the buffer number

Solution 2:

This is a command I created and added to my .vimrc to allow me to open a current buffer in a vertical split

command -nargs=1 Vsb call VsbFunction(<f-args>)

function VsbFunction (arg1)
  execute 'vert sb' a:arg1
endfunction

Solution 3:

You can use vim-fzf plugins and:

Similarly to {ctrlp.vim}{3}, use enter key, CTRL-T, CTRL-X or CTRL-V to open selected files in the current window, in new tabs, in horizontal splits, or in vertical splits respectively.

use :Buffers select and hit CTRL-V