Vim: How do you open another [No Name] buffer like the one on startup?

Vim

Vim Problem Overview


In my Vimscript program, I need to open an additional Vim buffer that is not immediately associated with a file, but which the user can save to a file of her/his choosing, just like the initial buffer called [No Name]. How can I do this?

Vim Solutions


Solution 1 - Vim

There are many ways to open a new buffer with no name, the simplest of which is :new.

:new will create a split window with an unnamed buffer.

:enew will open one in the current window.

:vnew will open one in a vertically split window.

:tabnew will open one in a new tab.

Solution 2 - Vim

In normal mode, type :new<CR>.

Solution 3 - Vim

You may also want to look into :sp filename

I use split pane all of the time - it's pretty great. In combination with screen you've got a lot of niceties there.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondanView Question on Stackoverflow
Solution 1 - VimRandy MorrisView Answer on Stackoverflow
Solution 2 - Vimicyrock.comView Answer on Stackoverflow
Solution 3 - VimArchbishopLollyView Answer on Stackoverflow