Home Explore Blog CI



neovim

16th chunk of `runtime/doc/autocmd.txt`
57e16e81530d5b8a4fd80540a402fe562f5ee6b3343694b10000000100000fa3
 for setting the window height.
				If the window is for another buffer, Vim
				executes the BufEnter autocommands after the
				WinEnter autocommands.
				Note: For split and tabpage commands the
				WinEnter event is triggered after the split
				or tab command but before the file is loaded.

							*WinLeave*
WinLeave			Before leaving a window.  If the window to be
				entered next is for a different buffer, Vim
				executes the BufLeave autocommands before the
				WinLeave autocommands (but not for ":new").
				Not used for ":qa" or ":q" when exiting Vim.
				Before WinClosed.
							*WinNew*
WinNew				When a new window was created.  Not done for
				the first window, when Vim has just started.
				Before WinEnter.

							*WinScrolled*
WinScrolled			After any window in the current tab page
				scrolled the text (horizontally or vertically)
				or changed width or height.  See
				|win-scrolled-resized|.

				Note: This can not be skipped with
				`:noautocmd`, because it triggers after
				processing normal commands when Vim is back in
				the main loop.  If you want to disable this,
				consider setting the 'eventignore' option
				instead.

				The pattern is matched against the |window-ID|
				of the first window that scrolled or resized.
				Both <amatch> and <afile> are set to the
				|window-ID|.

				|v:event| is set with information about size
				and scroll changes. |WinScrolled-event|

				Only starts triggering after startup finished
				and the first screen redraw was done.
				Does not trigger when defining the first
				WinScrolled or WinResized event, but may
				trigger when adding more.

				Non-recursive: the event will not trigger
				while executing commands for the WinScrolled
				event.  However, if the command causes a
				window to scroll or change size, then another
				WinScrolled event will be triggered later.


							*WinResized*
WinResized			After a window in the current tab page changed
				width or height.
				See |win-scrolled-resized|.

				|v:event| is set with information about size
				changes. |WinResized-event|

				Same behavior as |WinScrolled| for the
				pattern, triggering and recursiveness.

==============================================================================
6. Patterns					*autocmd-pattern* *{aupat}*

The {aupat} argument of `:autocmd` can be a comma-separated list.  This works as
if the command was given with each pattern separately.  Thus this command: >
	:autocmd BufRead *.txt,*.info set et
Is equivalent to: >
	:autocmd BufRead *.txt set et
	:autocmd BufRead *.info set et

The file pattern {aupat} is tested for a match against the file name in one of
two ways:
1. When there is no '/' in the pattern, Vim checks for a match against only
   the tail part of the file name (without its leading directory path).
2. When there is a '/' in the pattern, Vim checks for a match against both the
   short file name (as you typed it) and the full file name (after expanding
   it to a full path and resolving symbolic links).

The special pattern <buffer> or <buffer=N> is used for buffer-local
autocommands |autocmd-buflocal|.  This pattern is not matched against the name
of a buffer.

Examples: >
	:autocmd BufRead *.txt		set et
Set the 'et' option for all text files. >

	:autocmd BufRead /vim/src/*.c	set cindent
Set the 'cindent' option for C files in the /vim/src directory. >

	:autocmd BufRead /tmp/*.c	set ts=5
If you have a link from "/tmp/test.c" to "/home/nobody/vim/src/test.c", and
you start editing "/tmp/test.c", this autocommand will match.

Note:  To match part of a path, but not from the root directory, use a "*" as
the first character.  Example: >
	:autocmd BufRead */doc/*.txt	set tw=78
This autocommand will for example be executed for "/tmp/doc/xx.txt" and
"/usr/home/piet/doc/yy.txt".  The number of directories does not matter here.


The file name that the pattern is matched against is after expanding
wildcards.  Thus if you issue this command: >
	:e $ROOTDIR/main.$EXT

Title: Nvim Autocommand Events: WinLeave/New/Scrolled/Resized and Autocommand Patterns
Summary
This section details the WinLeave, WinNew, WinScrolled, and WinResized autocommand events in Nvim, including their triggering conditions and associated variables. It also explains how autocommand patterns are matched against file names, differentiating between patterns with and without '/' characters and the use of special patterns like <buffer>.