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

How do I open a new empty buffer in a horizontal split?

Answer

:new

Explanation

:new opens a new empty buffer in a horizontal split above the current window. It is the split equivalent of :enew — instead of replacing the current window with a blank buffer, it creates a new window for it, preserving the current window below.

Commands

Command Action
:new New empty buffer in a horizontal split
:vnew New empty buffer in a vertical split
:new {file} Open {file} in a horizontal split (like :split {file})
:enew New empty buffer in the current window (no split)
:tabnew New empty buffer in a new tab page

Keyboard equivalents

  • <C-w>n — same as :new (new horizontal split with empty buffer)
  • <C-w>v followed by :enew — new empty buffer in a vertical split

Example

Open a scratch buffer in a split to paste and manipulate temporary text:

:new
:setlocal buftype=nofile bufhidden=wipe noswapfile

This creates a disposable scratch pad that disappears when closed.

Open a vertical split with a new file to write alongside the current one:

:vnew notes.md

Tips

  • :new respects :set splitbelow and :set splitright for placement
  • :new with a filename is equivalent to :split {file} — it opens the file, not a blank buffer
  • The new window gets its own cursor position, folds, and local options
  • Use :leftabove new or :rightbelow new to control placement precisely

Next

How do I run a search and replace only within a visually selected region?