autoCmd

autocmd definitions

Type: list of (submodule)

Default: [ ]

Example:

''
  autoCmd = [
    {
      event = [ "BufEnter" "BufWinEnter" ];
      pattern = [ "*.c" "*.h" ];
      command = "echo 'Entering a C or C++ file'";
    }
  ];
''

Declared by:

autoCmd.*.buffer

Buffer number for buffer local autocommands |autocmd-buflocal|. Cannot be used with pattern.

Type: null or signed integer

Default: null

Declared by:

autoCmd.*.callback

A function or a string.

  • if a string, the name of a Vimscript function to call when this autocommand is triggered.

  • Otherwise, a Lua function which is called when this autocommand is triggered. Cannot be used with command. Lua callbacks can return true to delete the autocommand; in addition, they accept a single table argument with the following keys:

    • id: (number) the autocommand id
    • event: (string) the name of the event that triggered the autocommand |autocmd-events|
    • group: (number|nil) the autocommand group id, if it exists
    • match: (string) the expanded value of |<amatch>|
    • buf: (number) the expanded value of |<abuf>|
    • file: (string) the expanded value of |<afile>|
    • data: (any) arbitrary data passed to |nvim_exec_autocmds()|

Example using callback: autoCmd = [ { event = [ “BufEnter” “BufWinEnter” ]; pattern = [ “.c" ".h” ]; callback = { __raw = “function() print(‘This buffer enters’) end”; }; }

Type: null or string or raw lua code

Default: null

Declared by:

autoCmd.*.command

Vim command to execute on event. Cannot be used with callback.

Plugin default: ""

Type: null or string or raw lua code

Default: null

Declared by:

autoCmd.*.desc

A textual description of this autocommand.

Type: null or string

Default: null

Declared by:

autoCmd.*.description

DEPRECATED, please use desc.

Type: null or string

Default: null

Declared by:

autoCmd.*.event

The event or events to register this autocommand.

Type: null or string or list of string

Default: null

Declared by:

autoCmd.*.group

The autocommand group name or id to match against.

Type: null or string or signed integer

Default: null

Declared by:

autoCmd.*.nested

Run nested autocommands.

Plugin default: false

Type: null or boolean or raw lua code

Default: null

Declared by:

autoCmd.*.once

Run the autocommand only once.

Plugin default: false

Type: null or boolean or raw lua code

Default: null

Declared by:

autoCmd.*.pattern

Pattern or patterns to match literally against.

Type: null or string or list of string

Default: null

Declared by: