Home Explore Blog CI



neovim

16th chunk of `runtime/doc/windows.txt`
fbcfa2418fadcbeeb05dccf0b2514fa20f21a9fa37909a060000000100000fa0
 hidden, modified buffer, you will
get an error message and Vim will make that buffer the current buffer.  You
can then decide to write this buffer (":wq") or quit without writing (":q!").
Be careful: there may be more hidden, modified buffers!

A buffer can also be unlisted.  This means it exists, but it is not in the
list of buffers. |unlisted-buffer|


:files[!] [flags]				*:files*
:buffers[!] [flags]				*:buffers* *:ls*
:ls[!] [flags]
		Show all buffers.  Example:

			1 #h   "/test/text"		line 1 ~
			2u     "asdf"			line 0 ~
			3 %a + "version.c"		line 1 ~

		When the [!] is included the list will show unlisted buffers
		(the term "unlisted" is a bit confusing then...).

		Each buffer has a unique number.  That number will not change,
		thus you can always go to a specific buffer with ":buffer N"
		or "N CTRL-^", where N is the buffer number.

		Indicators (chars in the same column are mutually exclusive):
		u	an unlisted buffer (only displayed when [!] is used)
			   |unlisted-buffer|
		 %	the buffer in the current window
		 #	the alternate buffer for ":e #" and CTRL-^
		  a	an active buffer: it is loaded and visible
		  h	a hidden buffer: It is loaded, but currently not
			   displayed in a window |hidden-buffer|
		   `-`	a buffer with 'modifiable' off
		   =	a readonly buffer
		   R	a terminal buffer with a running job
		   F	a terminal buffer with a finished job
		   ?    a terminal buffer without a job: `:terminal NONE`
		    +	a modified buffer
		    x   a buffer with read errors

		[flags] can be a combination of the following characters,
		which restrict the buffers to be listed:
			+	modified buffers
			`-`	buffers with 'modifiable' off
			=	readonly buffers
			a	active buffers
			u	unlisted buffers (overrides the "!")
			h	hidden buffers
			x	buffers with a read error
			%	current buffer
			#	alternate buffer
			R	terminal buffers with a running job
			F	terminal buffers with a finished job
			t	show time last used and sort buffers
		Combining flags means they are "and"ed together, e.g.:
			h+	hidden buffers which are modified
			a+	active buffers which are modified

		When using |:filter| the pattern is matched against the
		displayed buffer name, e.g.: >
			filter /\.vim/ ls
<
						*:bad* *:badd*
:bad[d]	[+lnum] {fname}
		Add file name {fname} to the buffer list, without loading it,
		if it wasn't listed yet.  If the buffer was previously
		deleted, not wiped, it will be made listed again.
		If "lnum" is specified, the cursor will be positioned at that
		line when the buffer is first entered.  Note that other
		commands after the + will be ignored.

						 *:balt*
:balt [+lnum] {fname}
		Like `:badd` and also set the alternate file for the current
		window to {fname}.

:[N]bd[elete][!]			*:bd* *:bdel* *:bdelete* *E516*
:bd[elete][!] [N]
		Unload buffer [N] (default: current buffer) and delete it from
		the buffer list.  If the buffer was changed, this fails,
		unless when [!] is specified, in which case changes are lost.
		The file remains unaffected.  Any windows for this buffer are
		closed.  If buffer [N] is the current buffer, another buffer
		will be displayed instead.  This is the most recent entry in
		the jump list that points into a loaded buffer.
		Actually, the buffer isn't completely deleted, it is removed
		from the buffer list |unlisted-buffer| and option values,
		variables and mappings/abbreviations for the buffer are
		cleared. Examples: >
                    :.,$-bdelete   "delete buffers from the current one to
                                   " last but one
                    :%bdelete      " delete all buffers
<
:bdelete[!] {bufname}						*E93* *E94*
		Like ":bdelete[!] [N]", but buffer given by name, see
		|{bufname}|.

:bdelete[!] N1 N2 ...
		Do ":bdelete[!]" for buffer N1, N2, etc.  The arguments can be
		buffer numbers or buffer names (but not buffer names that are
		a number).  Insert a backslash before a space in a buffer
		name.

:N,Mbdelete[!]	Do ":bdelete[!]" for all buffers in

Title: Buffer Management Commands and Options
Summary
This section covers Vim's behavior when quitting with hidden, modified buffers and introduces the concept of unlisted buffers. It then details the `:files`, `:buffers`, and `:ls` commands used to display buffer information, including indicators for different buffer states (e.g., modified, hidden, active, unlisted), and flags to filter the buffer list. It also explains the `:bad[d]` and `:balt` commands for adding files to the buffer list, and the `:bd[elete]` command for unloading and deleting buffers from the buffer list, including how to force deletion and handle multiple buffers. It emphasizes that `:bdelete` removes the buffer from the list and clears associated settings.