`autocmd`s are commands executed automatically on certain events. Questions on creating or modifying `autocmd` definitions are appropriate for this tag.

One of Vim's most powerful features is its ability to run arbitrary commands on certain events for matching files.

Key Terms:

  • event: The set of events on which vim triggers autocmd execution. These include staring to writ a file (BufWrite), before exiting vim (VimLeavePre), etc.
  • pattern: A pattern to match file names for which an autocmd will be executed. Patterns can include wildcards, environment variables and special terms for buffer-local action.
  • command: The command to be executed.

Standard information: