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;
|
|
|
|
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-06 11:35:07 +00:00
|
|
|
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings {
|
|
|
|
insert = "<C-g>z";
|
|
|
|
insert_line = "<C-g>Z";
|
|
|
|
normal = "gz";
|
|
|
|
normal_cur = "gZ";
|
|
|
|
normal_line = "gzz";
|
|
|
|
normal_cur_line = "gZZ";
|
|
|
|
visual = "gz";
|
|
|
|
visual_line = "gZ";
|
|
|
|
delete = "gzd";
|
|
|
|
change = "gzr";
|
|
|
|
change_line = "gZR";
|
2023-10-16 09:04:47 +00:00
|
|
|
};
|
|
|
|
};
|
2023-06-07 11:28:27 +00:00
|
|
|
};
|
|
|
|
}
|