:sf in vim but split vertically?

≯℡__Kan透↙ 提交于 2019-12-24 13:06:20

问题


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.


回答1:


: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.




回答2:


:sp filename

Splits the screen horizontally

:vsp filename

Splits the screen vertically



来源:https://stackoverflow.com/questions/32399791/sf-in-vim-but-split-vertically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!