Home Explore Blog CI



neovim

7th chunk of `runtime/doc/usr_40.txt`
02833d487fccdbf0910864a3ac7a1cc64c93b69e1727308c0000000100000ac9
	Match any character once
	[abc]		Match the character a, b or c
	.		Matches a dot
	a{b,c}		Matches "ab" and "ac"

When the pattern includes a slash (/) Vim will compare directory names.
Without the slash only the last part of a file name is used.  For example,
"*.txt" matches "/home/biep/readme.txt".  The pattern "/home/biep/*" would
also match it.  But "home/foo/*.txt" wouldn't.
   When including a slash, Vim matches the pattern against both the full path
of the file ("/home/biep/readme.txt") and the relative path (e.g.,
"biep/readme.txt").

	Note:
	When working on a system that uses a backslash as file separator, such
	as MS-Windows, you still use forward slashes in autocommands.  This
	makes it easier to write the pattern, since a backslash has a special
	meaning.  It also makes the autocommands portable.


DELETING

To delete an autocommand, use the same command as what it was defined with,
but leave out the {command} at the end and use a !.  Example: >

	:autocmd! FileWritePre *

This will delete all autocommands for the "FileWritePre" event that use the
"*" pattern.


LISTING

To list all the currently defined autocommands, use this: >

	:autocmd

The list can be very long, especially when filetype detection is used.  To
list only part of the commands, specify the group, event and/or pattern.  For
example, to list all BufNewFile autocommands: >

	:autocmd BufNewFile

To list all autocommands for the pattern "*.c": >

	:autocmd * *.c

Using "*" for the event will list all the events.  To list all autocommands
for the cprograms group: >

	:autocmd cprograms


GROUPS

The {group} item, used when defining an autocommand, groups related autocommands
together.  This can be used to delete all the autocommands in a certain group,
for example.
   When defining several autocommands for a certain group, use the ":augroup"
command.  For example, let's define autocommands for C programs: >

	:augroup cprograms
	:  autocmd BufReadPost *.c,*.h :set sw=4 sts=4
	:  autocmd BufReadPost *.cpp   :set sw=3 sts=3
	:augroup END

This will do the same as: >

	:autocmd cprograms BufReadPost *.c,*.h :set sw=4 sts=4
	:autocmd cprograms BufReadPost *.cpp   :set sw=3 sts=3

To delete all autocommands in the "cprograms" group: >

	:autocmd! cprograms


NESTING

Generally, commands executed as the result of an autocommand event will not
trigger any new events.  If you read a file in response to a FileChangedShell
event, it will not trigger the autocommands that would set the syntax, for
example.  To make the events triggered, add the "++nested" flag: >

	:autocmd FileChangedShell * ++nested  edit


EXECUTING AUTOCOMMANDS

It is possible to trigger an autocommand by pretending an event has occurred.
This is useful to have one autocommand

Title: Autocommand Patterns, Deletion, Listing, Groups, Nesting, and Execution
Summary
This section elaborates on file patterns in autocommands, including character matching and handling directory names. It explains how to delete autocommands, list defined autocommands, group autocommands for easier management, and enable nesting for triggering new events. Finally, it touches on manually executing autocommands.