diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 204dcba7..fbc12bc1 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: "Delete old branches" - uses: beatlabs/delete-old-branches-action@v0.0.10 + uses: beatlabs/delete-old-branches-action@v0.0.11 with: repo_token: "${{ secrets.GITHUB_TOKEN }}" date: "1 months ago" 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"]` diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 12feeedb..9841291b 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -89,6 +89,7 @@ [blink.cmp]: https://github.com/saghen/blink.cmp - Add [blink.cmp] support. +- Add `LazyFile` user event. [diniamo](https://github.com/diniamo): @@ -249,8 +250,8 @@ syncing of nvim shell environment with direnv's. - Add [blink.cmp] source options and some default-disabled sources. - Add [blink.cmp] option to add - [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) - so blink.cmp can source snippets from it. + [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so + blink.cmp can source snippets from it. - Fix [blink.cmp] breaking when built-in sources were modified. [TheColorman](https://github.com/TheColorman): @@ -276,3 +277,7 @@ [Butzist](https://github.com/butzist): - Add Helm chart support under `vim.languages.helm`. + +[rice-cracker-dev](https://github.com/rice-cracker-dev): + +- `eslint_d` now checks for configuration files to load. diff --git a/modules/plugins/assistant/copilot/config.nix b/modules/plugins/assistant/copilot/config.nix index 37da046f..525fe3bd 100644 --- a/modules/plugins/assistant/copilot/config.nix +++ b/modules/plugins/assistant/copilot/config.nix @@ -37,6 +37,12 @@ in { inherit (cfg) setupOpts; after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()"; + event = [ + { + event = "User"; + pattern = "LazyFile"; + } + ]; cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"]; keys = [ (mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {}) diff --git a/modules/plugins/diagnostics/nvim-lint/config.nix b/modules/plugins/diagnostics/nvim-lint/config.nix index 49517f72..085140dc 100644 --- a/modules/plugins/diagnostics/nvim-lint/config.nix +++ b/modules/plugins/diagnostics/nvim-lint/config.nix @@ -13,7 +13,7 @@ in { vim = { startPlugins = ["nvim-lint"]; pluginRC.nvim-lint = entryAnywhere '' - require("lint").linters_by_ft(${toLuaObject cfg.linters_by_ft}) + require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft} ''; }; }; diff --git a/modules/plugins/languages/astro.nix b/modules/plugins/languages/astro.nix index 9e70424b..d5672af0 100644 --- a/modules/plugins/languages/astro.nix +++ b/modules/plugins/languages/astro.nix @@ -72,6 +72,16 @@ ls_sources, null_ls.builtins.diagnostics.eslint_d.with({ command = "${getExe pkg}", + condition = function(utils) + return utils.root_has_file({ + "eslint.config.js", + "eslint.config.mjs", + ".eslintrc", + ".eslintrc.json", + ".eslintrc.js", + ".eslintrc.yml", + }) + end, }) ) ''; diff --git a/modules/plugins/languages/svelte.nix b/modules/plugins/languages/svelte.nix index a3c55e10..4d96c20a 100644 --- a/modules/plugins/languages/svelte.nix +++ b/modules/plugins/languages/svelte.nix @@ -72,6 +72,16 @@ ls_sources, null_ls.builtins.diagnostics.eslint_d.with({ command = "${getExe pkg}", + condition = function(utils) + return utils.root_has_file({ + "eslint.config.js", + "eslint.config.mjs", + ".eslintrc", + ".eslintrc.json", + ".eslintrc.js", + ".eslintrc.yml", + }) + end, }) ) ''; diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index c9070554..790c235a 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -123,6 +123,16 @@ ls_sources, null_ls.builtins.diagnostics.eslint_d.with({ command = "${getExe pkg}", + condition = function(utils) + return utils.root_has_file({ + "eslint.config.js", + "eslint.config.mjs", + ".eslintrc", + ".eslintrc.json", + ".eslintrc.js", + ".eslintrc.yml", + }) + end, }) ) ''; 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}) diff --git a/modules/wrapper/lazy/lazy.nix b/modules/wrapper/lazy/lazy.nix index 5d67aa59..eb1f5cdf 100644 --- a/modules/wrapper/lazy/lazy.nix +++ b/modules/wrapper/lazy/lazy.nix @@ -126,7 +126,7 @@ }; event = mkOption { - type = nullOr (oneOf [str (listOf str) lznEvent]); + type = nullOr (oneOf [str lznEvent (listOf (either str lznEvent))]); default = null; description = "Lazy-load on event"; };