Vim: How do you open another [No Name] buffer like the one on startup?
VimVim 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.