From 866b983c4047b87bcdca6ab3673ed7bd602f0251 Mon Sep 17 00:00:00 2001 From: dish Date: Thu, 29 Jan 2026 14:48:48 -0500 Subject: [PATCH] autopairs/nvim-autopairs: lazy-load instead of always loading (#1370) This is suggested per the plugin's readme --- docs/manual/release-notes/rl-0.9.md | 3 +++ modules/plugins/autopairs/nvim-autopairs/config.nix | 13 +++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 476fce1b..966592db 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -147,6 +147,9 @@ - Added [hlargs.nvim](https://github.com/m-demare/hlargs.nvim) support as `visuals.hlargs-nvim`. +- Lazy-load `nvim-autopairs` plugin when using + `vim.autopairs.nvim-autopairs.enable` + [Machshev](https://github.com/machshev): - Added `ruff` and `ty` LSP support for Python under `programs.python`. diff --git a/modules/plugins/autopairs/nvim-autopairs/config.nix b/modules/plugins/autopairs/nvim-autopairs/config.nix index 6566ec28..1a55273a 100644 --- a/modules/plugins/autopairs/nvim-autopairs/config.nix +++ b/modules/plugins/autopairs/nvim-autopairs/config.nix @@ -4,17 +4,14 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.lua) toLuaObject; - cfg = config.vim.autopairs.nvim-autopairs; in { config = mkIf cfg.enable { - vim = { - startPlugins = ["nvim-autopairs"]; - pluginRC.autopairs = entryAnywhere '' - require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts}) - ''; + vim.lazy.plugins.nvim-autopairs = { + package = "nvim-autopairs"; + setupModule = "nvim-autopairs"; + setupOpts = cfg.setupOpts; + event = ["InsertEnter"]; }; }; }