Home Explore Blog CI



neovim

5th chunk of `runtime/doc/autocmd.txt`
d28c8430bda474e5e42867e2dfeb4a43a5f63345f76c6f780000000100000fa3
	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
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
				Not triggered when exiting and v:dying is 2 or
				more.
							*BufWipeout*
BufWipeout			Before completely deleting a buffer.  The
				BufUnload and BufDelete events may be called
				first (if the buffer was loaded and was in the
				buffer list).  Also used just before a buffer
				is renamed (also when it's not in the buffer
				list).
				NOTE: Current buffer "%" is not the target
				buffer "<afile>", "<abuf>". |<buffer=abuf>|
				Do not change to another buffer.
						*BufWrite* *BufWritePre*
BufWrite or BufWritePre		Before writing the whole buffer to a file.
							*BufWriteCmd*
BufWriteCmd			Before writing the whole buffer to a file.
				Should do the writing of the file and reset
				'modified' if successful, unless '+' is in
				'cpo' and writing to another file |cpo-+|.
				The buffer contents should not be changed.
				When the command resets 'modified' the undo
				information is adjusted to mark older undo
				states as 'modified', like |:write| does.  Use
				the |'[| and |']| marks for the range of lines.
				|Cmd-event|
							*BufWritePost*
BufWritePost			After writing the whole buffer to a file
				(should undo the commands for BufWritePre).
							*ChanInfo*
ChanInfo			State of channel changed, for instance the
				client of a RPC channel described itself.
				This is triggered even when inside an
				autocommand defined without |autocmd-nested|.
				Sets these |v:event| keys:
				    info	as from |nvim_get_chan_info()|
							*ChanOpen*
ChanOpen			Just after a channel was opened.
				This is triggered even when inside an
				autocommand defined without |autocmd-nested|.
				Sets these |v:event| keys:
				    info	as from |nvim_get_chan_info()|
							*CmdUndefined*
CmdUndefined			When a user command is used but it isn't
				defined.  Useful for defining a command only
				when it's used.  The pattern is matched
				against the command name.  Both <amatch> and
				<afile> expand to the command name.
				This is triggered even when inside an
				autocommand defined without |autocmd-nested|.
				NOTE: Autocompletion won't work until the
				command is defined.  An alternative is to
				always define the user command and have it
				invoke an autoloaded function.  See |autoload|.
							*CmdlineChanged*
CmdlineChanged			After a change was made to the text inside
				command line.  Be careful not to mess up the
				command line, it may cause Vim to lock up.
				<afile> expands to the |cmdline-char|.
							*CmdlineEnter*
CmdlineEnter			After entering the command-line (including
				non-interactive use of ":" in a mapping: use
				|<Cmd>| instead to avoid this).
				The pattern is matched against |cmdline-char|.
				<afile> expands to the |cmdline-char|.
				Sets these |v:event| keys:
				    cmdlevel
				    cmdtype
							*CmdlineLeave*
CmdlineLeave			Before leaving the command-line (including
				non-interactive use of ":" in a mapping: use
				|<Cmd>| instead to avoid this).

Title: Nvim Autocommand Events (Continued): Buffers, Writes, and Channels
Summary
This section continues the list of Nvim autocommand events. It details BufWinEnter, BufWinLeave, BufWipeout, BufWrite, BufWritePre, BufWriteCmd, BufWritePost, ChanInfo, and ChanOpen events, specifying when each is triggered. It also describes CmdUndefined, CmdlineChanged, CmdlineEnter, and CmdlineLeave, triggered by command-line activity.