2023-06-07 13:28:27 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: let
|
2024-10-06 13:35:07 +02:00
|
|
|
inherit (lib.modules) mkIf;
|
2023-11-07 01:50:27 +01:00
|
|
|
|
2023-06-07 13:28:27 +02:00
|
|
|
cfg = config.vim.utility.surround;
|
2024-11-04 16:50:50 +01:00
|
|
|
mkLznKey = mode: key: {
|
2024-12-21 01:14:52 +01:00
|
|
|
inherit mode key;
|
2024-11-04 16:50:50 +01:00
|
|
|
};
|
2023-06-07 13:28:27 +02:00
|
|
|
in {
|
2023-10-16 11:04:47 +02:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim = {
|
2024-11-04 16:50:50 +01:00
|
|
|
lazy.plugins.nvim-surround = {
|
|
|
|
package = "nvim-surround";
|
2024-12-21 01:14:52 +01:00
|
|
|
|
2024-11-04 16:50:50 +01:00
|
|
|
setupModule = "nvim-surround";
|
|
|
|
inherit (cfg) setupOpts;
|
|
|
|
|
2024-12-21 01:14:52 +01:00
|
|
|
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)
|
|
|
|
];
|
2023-10-16 11:04:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-06-07 13:28:27 +02:00
|
|
|
};
|
|
|
|
}
|