From e2d10e8fb20c8a366a23bcd97535ecd3b3b940c8 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang <badnam3o.0@gmail.com>
Date: Sat, 22 Mar 2025 15:02:13 +0100
Subject: [PATCH] lazy: create LazyFile user event

---
 modules/wrapper/lazy/config.nix | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix
index 3468d5ec..c1bd8829 100644
--- a/modules/wrapper/lazy/config.nix
+++ b/modules/wrapper/lazy/config.nix
@@ -134,6 +134,15 @@ in {
       startPlugins = ["lz-n" "lzn-auto-require"];
 
       optPlugins = pluginPackages;
+      augroups = [{name = "nvf_lazy_file_hooks";}];
+      autocmds = [
+        {
+          event = ["BufReadPost" "BufNewFile" "BufWritePre"];
+          group = "nvf_lazy_file_hooks";
+          command = "doautocmd User LazyFile";
+          once = true;
+        }
+      ];
 
       lazy.builtLazyConfig = ''
         require('lz.n').load(${toLuaObject lznSpecs})