diff --git a/docs-preview-1138/index.xhtml b/docs-preview-1138/index.xhtml index a67659a7..e87395e1 100644 --- a/docs-preview-1138/index.xhtml +++ b/docs-preview-1138/index.xhtml @@ -787,7 +787,7 @@ Each entry in the list is a submodule with the following options:
vim.autocmds
) Autocommands (autocmd
) trigger actions based on events happening within Neovim
(e.g., saving a file, entering a buffer). Each entry in the list is a submodule
-with the following options:
Option | Type | Default | Description | Example |
---|---|---|---|---|
enable | bool | true | Enables or disables this autocommand definition. | true |
event | nullOr (listOf str) | null | Required. List of Neovim events that trigger this autocommand (e.g., BufWritePre , FileType ). | [ "BufWritePre" ] |
pattern | nullOr (listOf str) | null | List of file patterns (globs) to match against (e.g., *.py , * ). If null , matches all files for the given event. | [ "*.lua", "*.nix" ] |
callback | nullOr luaInline | null | A Lua function to execute when the event triggers. Use lib.nvim.types.luaInline or lib.options.literalExpression "mkLuaInline '''...'''" . Cannot be used with command . | lib.nvim.types.luaInline "function() print('File saved!') end" |
command | nullOr str | null | A Vimscript command to execute when the event triggers. Cannot be used with callback . | "echo 'File saved!'" |
group | nullOr str | null | The name of an augroup (defined in vim.augroups ) to associate this autocommand with. | "MyCustomAuGroup" |
desc | nullOr str | null | A description for the autocommand (useful for introspection). | "Format buffer on save" |
once | bool | false | If true , the autocommand runs only once and then automatically removes itself. | false |
nested | bool | false | If true , allows this autocommand to trigger other autocommands. | false |
You cannot define both callback
(for Lua functions) and command
(for
+with the following options:
Option | Type | Default | Description | Example |
---|---|---|---|---|
enable | bool | true | Enables or disables this autocommand definition. | true |
event | nullOr (listOf str) | null | Required. List of Neovim events that trigger this autocommand (e.g., BufWritePre , FileType ). | [ "BufWritePre" ] |
pattern | nullOr (listOf str) | null | List of file patterns (globs) to match against (e.g., *.py , * ). If null , matches all files for the given event. | [ "*.lua", "*.nix" ] |
callback | nullOr luaInline | null | A Lua function to execute when the event triggers. Use lib.generators.mkLuaInline . Cannot be used with command . | lib.generators.mkLuaInline "function() print('File saved!') end" |
command | nullOr str | null | A Vimscript command to execute when the event triggers. Cannot be used with callback . | "echo 'File saved!'" |
group | nullOr str | null | The name of an augroup (defined in vim.augroups ) to associate this autocommand with. | "MyCustomAuGroup" |
desc | nullOr str | null | A description for the autocommand (useful for introspection). | "Format buffer on save" |
once | bool | false | If true , the autocommand runs only once and then automatically removes itself. | false |
nested | bool | false | If true , allows this autocommand to trigger other autocommands. | false |
You cannot define both callback
(for Lua functions) and command
(for
Vimscript) for the same autocommand. Choose one.
Examples:
{ lib, ... }:
{
vim.augroups = [ { name = "UserSetup"; } ];
@@ -799,7 +799,7 @@ Vimscript) for the same autocommand. Choose one.
null
Example:
mkLuaInline ''
+Example:
lib.generators.mkLuaInline ''
function()
print("Saving a Lua file...")
end