Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split and find file in Vim like :sf but vertically

Tags:

vim

I use :sf <filename> with Vim a lot, to split horizontally and edit the said file in the new window.

I wonder what's the equivalent command to do the same but split vertically rather than horizontally.

:vne seems the closest I can find to this, but the help says it doesn't search for the file like :sf does.

like image 819
bjfletcher Avatar asked Aug 30 '25 18:08

bjfletcher


1 Answers

:vert sf <filename>

From :h :vert:

                        *:vert* *:vertical*
:vert[ical] {cmd}
        Execute {cmd}.  If it contains a command that splits a window,
        it will be split vertically.
        Doesn't work for |:execute| and |:normal|.

Note: The usual way of describing the 'direction' of a split (vertical/horiontal) is by the axis of the split, not the layout of the windows, so you're actually looking for a vertical split here.

like image 105
Marth Avatar answered Sep 04 '25 07:09

Marth