From d105f699219954d973a9f56c60b1be120b67fde4 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 22 Mar 2025 15:13:44 +0100 Subject: [PATCH] docs: mention LazyFile --- .../configuring/custom-plugins/lazy-method.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/manual/configuring/custom-plugins/lazy-method.md b/docs/manual/configuring/custom-plugins/lazy-method.md index c6fd7106..ae766535 100644 --- a/docs/manual/configuring/custom-plugins/lazy-method.md +++ b/docs/manual/configuring/custom-plugins/lazy-method.md @@ -38,3 +38,22 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via }; } ``` + +## LazyFile event {#sec-lazyfile-event} + +You can use the `LazyFile` user event to load a plugin when a file is opened: + +```nix +{ + config.vim.lazy.plugins = { + "aerial.nvim" = { + package = pkgs.vimPlugins.aerial-nvim; + event = [{event = "User"; pattern = "LazyFile";}]; + # ... + }; + }; +} +``` + +You can consider `LazyFile` as an alias to +`["BufReadPost" "BufNewFile" "BufWritePre"]`