Home Explore Blog CI



neovim

3rd chunk of `runtime/doc/autocmd.txt`
5f7ae4bd2029bcb8b4ab0146b5f30ac3183f6062985e24e50000000100000fa6
	Note: a quote will be seen as argument to the :autocmd
			and won't start a comment.
			Warning: You should normally not do this without a
			group, it breaks plugins, syntax highlighting, etc.

When the [group] argument is not given, Vim uses the current group (as defined
with ":augroup"); otherwise, Vim uses the group defined with [group].

==============================================================================
4. Listing autocommands					*autocmd-list*

:au[tocmd] [group] {event} {aupat}
			Show the autocommands associated with {event} and
			{aupat}.

:au[tocmd] [group] * {aupat}
			Show the autocommands associated with {aupat} for all
			events.

:au[tocmd] [group] {event}
			Show all autocommands for {event}.

:au[tocmd] [group]	Show all autocommands.

If you provide the [group] argument, Vim lists only the autocommands for
[group]; otherwise, Vim lists the autocommands for ALL groups.  Note that this
argument behavior differs from that for defining and removing autocommands.

In order to list buffer-local autocommands, use a pattern in the form <buffer>
or <buffer=N>.  See |autocmd-buflocal|.

							*:autocmd-verbose*
When 'verbose' is non-zero, listing an autocommand will also display where it
was last defined. Example: >

    :verbose autocmd BufEnter
    FileExplorer  BufEnter
	*	  call s:LocalBrowse(expand("<amatch>"))
	    Last set from /usr/share/vim/vim-7.0/plugin/NetrwPlugin.vim
<
See |:verbose-cmd| for more information.

==============================================================================
5. Events					*autocmd-events* *E215* *E216*

You can specify a comma-separated list of event names.  No white space can be
used in this list.  The command applies to all the events in the list.

For READING FILES there are four kinds of events possible:
	BufNewFile			starting to edit a non-existent file
	BufReadPre	BufReadPost	starting to edit an existing file
	FilterReadPre	FilterReadPost	read the temp file with filter output
	FileReadPre	FileReadPost	any other file read
Vim uses only one of these four kinds when reading a file.  The "Pre" and
"Post" events are both triggered, before and after reading the file.

Note that the autocommands for the "*ReadPre" events and all the Filter events
are not allowed to change the current buffer (you will get an error message if
this happens).  This is to prevent the file to be read into the wrong buffer.

Note that the 'modified' flag is reset AFTER executing the BufReadPost
and BufNewFile autocommands.  But when the 'modified' option was set by the
autocommands, this doesn't happen.

You can use the 'eventignore' option to ignore a number of events or all
events.

							*events* *{event}*
Nvim recognizes the following events.  Names are case-insensitive.

							*BufAdd*
BufAdd				After adding a new buffer or existing unlisted
				buffer to the buffer list (except during
				startup, see |VimEnter|), or renaming a listed
				buffer.
				Before |BufEnter|.
				NOTE: Current buffer "%" is not 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

Title: Nvim Autocommands: Listing, Verbose Mode, and Events
Summary
This section describes how to list autocommands and use verbose mode to display where they were defined. It details how to use <buffer> or <buffer=N> to list buffer-local autocommands. It then lists Nvim autocommand events, including events for reading files, and discusses how events are triggered and can be ignored using the 'eventignore' option. Finally, it describes several events, including BufAdd, BufDelete, BufEnter, BufFilePost, BufFilePre, and BufHidden.