2023-06-07 11:28:27 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-10-06 11:35:07 +00:00
|
|
|
inherit (lib.modules) mkIf;
|
2024-03-24 00:14:39 +00:00
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-10-06 11:35:07 +00:00
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-06-07 11:28:27 +00:00
|
|
|
cfg = config.vim.utility.surround;
|
2024-10-06 18:13:39 +00:00
|
|
|
mkLznKey = mode: key: {
|
|
|
|
inherit key mode;
|
|
|
|
};
|
2023-06-07 11:28:27 +00:00
|
|
|
in {
|
2023-10-16 09:04:47 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim = {
|
2024-10-06 11:35:07 +00:00
|
|
|
startPlugins = ["nvim-surround"];
|
|
|
|
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
2023-06-07 11:28:27 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
lazy.plugins.nvim-surround = {
|
|
|
|
package = "nvim-surround";
|
|
|
|
setupModule = "nvim-surround";
|
|
|
|
inherit (cfg) setupOpts;
|
2024-10-06 18:13:39 +00:00
|
|
|
|
2024-10-17 15:17:18 +00:00
|
|
|
keys =
|
2024-10-31 13:16:46 +00:00
|
|
|
[
|
|
|
|
(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"]) [
|
|
|
|
"<Plug>(nvim-surround-insert)"
|
|
|
|
"<Plug>(nvim-surround-insert-line)"
|
|
|
|
"<Plug>(nvim-surround-normal)"
|
|
|
|
"<Plug>(nvim-surround-normal-cur)"
|
|
|
|
"<Plug>(nvim-surround-normal-line)"
|
|
|
|
"<Plug>(nvim-surround-normal-cur-line)"
|
|
|
|
"<Plug>(nvim-surround-visual)"
|
|
|
|
"<Plug>(nvim-surround-visual-line)"
|
|
|
|
"<Plug>(nvim-surround-delete)"
|
|
|
|
"<Plug>(nvim-surround-change)"
|
|
|
|
"<Plug>(nvim-surround-change-line)"
|
|
|
|
];
|
2024-10-17 15:17:18 +00:00
|
|
|
};
|
2023-10-16 09:04:47 +00:00
|
|
|
};
|
2023-06-07 11:28:27 +00:00
|
|
|
};
|
|
|
|
}
|