Creating Buffers in Neovim

Vim can open files and create buffers using a variety of commands:

CommandActionPattern
:editedit a file:edit [path/to/file]
:readread file into the text:read [path/to/file]
:newcreate a new empty window
:enewedit a new, unnamed buffer

Commands that take paths generally accept both relative and absolute paths.

The commands summarized above each perform similar tasks, but the :read command offers and extra bit of functionality that can be useful in some situations: in addition to accepting a path as an argument, :read can also insert the output of shell commands into the current buffer. For example, to insert the current time into Vim one might execute:

:read !date '%T'

which inserts the current time at the current cursor location.

No-Name Buffers

You might have noticed that when a file is loaded into a buffer, the buffer takes the name of the file. So what happens when an empty buffer is opened? In that case, the buffer is called a "no-name" buffer.

No-name buffers are just like any other buffers, and the content can be saved to a file or simply thrown away.

No-Name buffers convert to regular when they are saved, at which point they take the name of the file to which they were saved. Jump forward to saving buffers to see how that is done.