Home Explore Blog CI



neovim

4th chunk of `runtime/doc/autocmd.txt`
3298dc17f0ee52c657481a2926044661a6a9197bec2493060000000100000fa2
 the target
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
							*BufDelete*
BufDelete			Before deleting a buffer from the buffer list.
				The BufUnload may be called first (if the
				buffer was loaded).
				Also used just before a buffer in the buffer
				list is renamed.
				NOTE: Current buffer "%" is not the target
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
				Do not change to another buffer.
							*BufEnter*
BufEnter			After entering (visiting, switching-to) a new
				or existing buffer. Useful for setting
				filetype options.  Compare |BufNew| which
				does not trigger for existing buffers.
				After |BufAdd|.
				After |BufReadPost|.
							*BufFilePost*
BufFilePost			After changing the name of the current buffer
				with the ":file" or ":saveas" command.
							*BufFilePre*
BufFilePre			Before changing the name of the current buffer
				with the ":file" or ":saveas" command.
							*BufHidden*
BufHidden			Before a buffer becomes hidden: when there are
				no longer windows that show the buffer, but
				the buffer is not unloaded or deleted.

				Not used for ":qa" or ":q" when exiting Vim.
				NOTE: Current buffer "%" is not the target
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
							*BufLeave*
BufLeave			Before leaving to another buffer.  Also when
				leaving or closing the current window and the
				new current window is not for the same buffer.

				Not used for ":qa" or ":q" when exiting Vim.
							*BufModifiedSet*
BufModifiedSet			After the `'modified'` value of a buffer has
				been changed.
							*BufNew*
BufNew				After creating a new buffer (except during
				startup, see |VimEnter|) or renaming an
				existing buffer. Unlike |BufEnter|, visiting
				(switching to) an existing buffer will not
				trigger this again.
				NOTE: Current buffer "%" is not the target
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
				See also |BufAdd|, |BufNewFile|.
							*BufNewFile*
BufNewFile			When starting to edit a file that doesn't
				exist.  Can be used to read in a skeleton
				file.
						*BufRead* *BufReadPost*
BufRead or BufReadPost		When starting to edit a new buffer, after
				reading the file into the buffer, before
				processing modelines.  See |BufWinEnter| to do
				something after processing modelines.
				Also triggered:
				- when writing an unnamed buffer in a way that
				  the buffer gets a name
				- after successfully recovering a file
				- for the "filetypedetect" group when
				  executing ":filetype detect"
				Not triggered:
				- for the `:read file` command
				- when the file doesn't exist
							*BufReadCmd*
BufReadCmd			Before starting to edit a new buffer.  Should
				read the file into the buffer. |Cmd-event|
						*BufReadPre* *E200* *E201*
BufReadPre			When starting to edit a new buffer, before
				reading the file into the buffer.  Not used
				if the file doesn't exist.
							*BufUnload*
BufUnload			Before unloading a buffer, when the text in
				the buffer is going to be freed.
				After BufWritePost.
				Before BufDelete.
				Triggers for all loaded buffers when Vim is
				going to exit.
				NOTE: Current buffer "%" is not the target
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
				Do not switch buffers or windows!
				Not triggered when exiting and v:dying is 2 or
				more.
							*BufWinEnter*
BufWinEnter			After a buffer is displayed in a window.  This
				may be when the buffer is loaded (after
				processing modelines) or when a hidden buffer
				is displayed (and is no longer hidden).

				Not triggered for |:split| without arguments,
				since the buffer does not change, or :split
				with a file already open in a window.
				Triggered for ":split" with the name of the
				current buffer, since it reloads that buffer.
							*BufWinLeave*
BufWinLeave			Before a buffer is removed from a window.
				Not when it's still visible in another window.
				Also triggered when exiting.
				Before BufUnload, BufHidden.
				NOTE: Current buffer "%" is not the target

Title: Nvim Autocommand Events (Continued): Buffer States
Summary
This section continues the list of Nvim autocommand events, focusing on events related to buffer states and their transitions. Events covered include BufHidden, BufLeave, BufModifiedSet, BufNew, BufNewFile, BufRead, BufReadPost, BufReadCmd, BufReadPre, BufUnload, BufWinEnter, and BufWinLeave. Each event description specifies when it is triggered and any associated notes or restrictions.