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

How do I open a split window that spans the full width or height of the editor instead of splitting only the current window?

Answer

:botright split

Explanation

When you split a window with :split or :vsplit, Vim subdivides only the current window. Prefixing with :botright or :topleft tells Vim to open the new window at the absolute edge of the screen, spanning all existing rows or columns. This is especially useful for terminals, quickfix lists, or reference files you want to keep at a consistent size.

How it works

  • :botright split {file} — horizontal split at the bottom, full screen width
  • :topleft split {file} — horizontal split at the top, full screen width
  • :botright vsplit {file} — vertical split on the right, full screen height
  • :topleft vsplit {file} — vertical split on the left, full screen height
  • These modifiers work with any :split-family command: :new, :vnew, :terminal, :copen, etc.

Example

Open a terminal at the bottom of the screen regardless of how many horizontal or vertical splits exist:

:botright 15split term://zsh

Open the quickfix window spanning the full width:

:botright copen

Tips

  • Combine with a size: :botright 10split creates a 10-line-high bottom pane
  • :vertical topleft split can be abbreviated to :vert topleft sp
  • To always open :copen full-width, add autocmd QuickFixCmdPost * botright copen to your vimrc
  • <C-w>J moves the current window to occupy the full bottom row after the fact

Next

How do I match a pattern only when it is preceded or followed by another pattern, without including that context in the match?