This is a follow-up question from this Question and Answer.

Is it possible, and if so how, to open two (or more) new empty buffers in Vim (without associating them to a file), such that they both take on the whole window? (And such that you can move among them with :bprev / :bnext, i.e. in the exact same way, as if you did :badd <filename>?)

In other words, I don't want splits and tabs, just "normal" buffers.

I tried :enew twice, but the second buffer discards the first one...

To put it in a different way: what is the Vim equivalent of opening more new empty files in a GUI text editor?

Still in other words

I want something like this:

  1 #a   "[No Name]"                    line 0
  2 %a   "[No Name]"                    line 1

But 1 and 2 should NOT be in split window, both should have their own window, taking up the full screen. (Just as if I did :badd <filename>. Pity that :badd without arguments does not open a new empty window.)

  • how about :enew|:new? Aug 11, 2020 at 18:29
  • @BLayer, Christian : I tried both now, but the two buffers are a split in the same window. Maybe the right question is, how to have two new empty windows? I'll edit the title accordingly.
    – Attilio
    Aug 11, 2020 at 18:42
  • I probably used the terms incorrectly. Anyway :set hidden was the solution I needed. After that, I can just do many :enew's (as long as I add some content), and they are not lost. I am using terminal vim, in case that matters. (Maybe I'm doing something wrong, but :new still opens the new buffer for me in a split, i.e. the screen area is split into two equal spaces for the two empty buffers, they don't take up the whole screen.)
    – Attilio
    Aug 11, 2020 at 18:58
  • 1
    @Attilio Understanding that someone could post an alternative, possibly better for you, answer later, does my suggestion meet your needs? If so, I'll add a proper answer so no one need wade through all these comments (which we can then delete).
    – B Layer
    Aug 11, 2020 at 19:13
  • 1
    @BLayer: yes the one with :set hidden does what I need, it would be worth an answer.
    – Attilio
    Aug 11, 2020 at 19:26

2 Answers 2


First thing's first, let's make sure our definitions are in sync. Per, :h window:

  • A buffer is the in-memory text of a file.
  • A window is a viewport on a buffer.
  • (And for the sake of completeness) A tab page is a collection of windows.

Above these things are your terminal window or your GUI window which contain Vim. Vim has no direct control over these kinds of windows and we will not refer to them beyond this point.

Second, there's an important setting that will impact how things work: 'hidden'. By default this is disabled and when that's the case one of its effects is to delete empty buffers if they go out of view. That will cramp our style so do :set hidden.

As an aside, many people can't live without enabling this because doing so allows a much better, buffer-centric workflow than you can get otherwise. There are volumes written about this and, coincidentally, in the last couple days I was proselytizing about it here in some comments.

Anyways, back on topic, now that we have 'hidden' enabled we just need to run one or two basic commands. First, :new. This will open a new window (a "split") and it will contain a fresh, new buffer. If your preference is one window per buffer that's all you need. You can keep running it until you are sated.

TIP: after the first :new use Normal mode command @: to repeat it. Precede with a number to repeat it that many times.

On the other hand, if you only want a single window with all but the original buffer hidden (and accessible with, for example, :bnext) then simply enter a second command :close. Repeat :new then :close as often as needed. Better yet, use :new | close. Then you can use the same tip as above [count]@:.

That's pretty much it.

(Note: :enew will open a fresh, new buffer without opening a split but it will clobber any fresh, new buffer already opened in the same window. You'd have to modify the existing buffer to avoid this.)

  • 1
    Thanks, the :new | close part (together with :set hidden) does exactly what I need.
    – Attilio
    Aug 11, 2020 at 20:03
  • @Attilio Awesome. Glad to hear it.
    – B Layer
    Aug 11, 2020 at 20:04

:hide enew is what the OP asked for.

This will hide - not destroy - whatever is in the current buffer of the current window and open a new NO-FILE in-memory-only buffer.

  • 1
    Probably worth noting that this will work even if the 'hidden' option is not set.
    – Rich
    Nov 18, 2020 at 13:43
  • Right, it will set 'hidden' even if it was not set before. :he :hide Nov 19, 2020 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.