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

How do I create a new empty buffer?

Answer

:enew

Explanation

The :enew command creates a new unnamed empty buffer in the current window. This is useful for scratch work or starting a new file.

How it works

  • :enew replaces the current window content with an empty buffer
  • :new creates a new window with an empty buffer (horizontal split)
  • :vnew creates a new window with an empty buffer (vertical split)

Example

:enew              " New empty buffer in current window
:new               " New empty buffer in horizontal split
:vnew              " New empty buffer in vertical split

Tips

  • :w filename saves the empty buffer to a file
  • :setlocal buftype=nofile makes it a scratch buffer (no save prompt)
  • :enew! forces creation even with unsaved changes
  • Useful for temporary calculations or notes
  • The empty buffer gets the next available buffer number

Next

How do you yank a single word into a named register?