diff --git a/modules/plugins/utility/surround/config.nix b/modules/plugins/utility/surround/config.nix index 7161cf6bd..31b4033dd 100644 --- a/modules/plugins/utility/surround/config.nix +++ b/modules/plugins/utility/surround/config.nix @@ -4,51 +4,33 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.utility.surround; mkLznKey = mode: key: { - inherit key mode; + inherit mode key; }; in { config = mkIf cfg.enable { vim = { - startPlugins = ["nvim-surround"]; - pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})"; - lazy.plugins.nvim-surround = { package = "nvim-surround"; + setupModule = "nvim-surround"; inherit (cfg) setupOpts; - keys = - [ - (mkLznKey ["i"] cfg.setupOpts.keymaps.insert) - (mkLznKey ["i"] cfg.setupOpts.keymaps.insert_line) - (mkLznKey ["x"] cfg.setupOpts.keymaps.visual) - (mkLznKey ["x"] cfg.setupOpts.keymaps.visual_line) - (mkLznKey ["n"] cfg.setupOpts.keymaps.normal) - (mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur) - (mkLznKey ["n"] cfg.setupOpts.keymaps.normal_line) - (mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur_line) - (mkLznKey ["n"] cfg.setupOpts.keymaps.delete) - (mkLznKey ["n"] cfg.setupOpts.keymaps.change) - (mkLznKey ["n"] cfg.setupOpts.keymaps.change_line) - ] - ++ map (mkLznKey ["n" "i" "v"]) [ - "(nvim-surround-insert)" - "(nvim-surround-insert-line)" - "(nvim-surround-normal)" - "(nvim-surround-normal-cur)" - "(nvim-surround-normal-line)" - "(nvim-surround-normal-cur-line)" - "(nvim-surround-visual)" - "(nvim-surround-visual-line)" - "(nvim-surround-delete)" - "(nvim-surround-change)" - "(nvim-surround-change-line)" - ]; + keys = [ + (mkLznKey "i" cfg.setupOpts.keymaps.insert) + (mkLznKey "i" cfg.setupOpts.keymaps.insert_line) + (mkLznKey "x" cfg.setupOpts.keymaps.visual) + (mkLznKey "x" cfg.setupOpts.keymaps.visual_line) + (mkLznKey "n" cfg.setupOpts.keymaps.normal) + (mkLznKey "n" cfg.setupOpts.keymaps.normal_cur) + (mkLznKey "n" cfg.setupOpts.keymaps.normal_line) + (mkLznKey "n" cfg.setupOpts.keymaps.normal_cur_line) + (mkLznKey "n" cfg.setupOpts.keymaps.delete) + (mkLznKey "n" cfg.setupOpts.keymaps.change) + (mkLznKey "n" cfg.setupOpts.keymaps.change_line) + ]; }; }; };