commit 289695c14efcb2cb61ea70a0dbaf0025f869b21c
parent 97c39be1641ed49bbcfb7b613f672b13ccd409a2
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat, 14 Feb 2026 06:55:53 +0800
vim-patch:48cee53: runtime(doc): Clarify :bd behaviour
closes: vim/vim#19389
https://github.com/vim/vim/commit/48cee53615069e3a5a04be265440180e29f9997a
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
@@ -1181,15 +1181,22 @@ list of buffers. |unlisted-buffer|
: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.
+ unless [!] 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: >
+ cleared. If [N] is the last listed buffer in a window (i.e.,
+ there is no other listed buffer to switch to), the buffer is
+ emptied instead of being unloaded. The window is not closed,
+ and the buffer may be reused as a new buffer |buffer-reuse|.
+ This ensures every window always has a valid buffer.
+
+ Examples: >
:.,$-bdelete " delete buffers from the current one to
" last but one
:%bdelete " delete all buffers