vimtricks.wiki Concise Vim tricks, one at a time.

How do I force any window-opening command to create a vertical split instead of horizontal?

Answer

:vertical {cmd}

Explanation

The :vertical command modifier forces any window-opening Ex command to create a vertical split instead of the default horizontal split. This is especially useful for commands that always split horizontally and offer no direct vertical variant.

How it works

  • :vertical is a modifier prefix you can prepend to any Ex command that opens a window
  • Vim interprets it as an instruction to use vertical layout for the resulting window
  • It works even with commands like :help and :diffsplit that don't have a built-in vertical option

Example

Opening help horizontally (default):

:help motion

Opening the same help page in a vertical split:

:vertical help motion

Other useful combinations:

:vertical diffsplit file.txt    " diff in a vertical split
:vertical new                   " new empty buffer in vertical split
:vertical sbuffer 3             " open buffer 3 in vertical split

Tips

  • :vert works as a short form: :vert help {topic}
  • Complement with :topleft, :botright, :aboveleft, :belowright to also control the split direction (left/right/above/below)
  • Particularly handy for :vertical help since :help always opens horizontally by default and you normally need <C-w>L to convert it afterward

Next

How do I make Vim automatically reformat paragraphs as I type so lines stay within the textwidth?