neovim-flake/modules/plugins/utility/surround/config.nix

33 lines
768 B
Nix
Raw Permalink Normal View History

2023-06-07 13:28:27 +02:00
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
2024-03-24 01:14:39 +01:00
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
2023-06-07 13:28:27 +02:00
cfg = config.vim.utility.surround;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-surround"];
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
2023-06-07 13:28:27 +02: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-06-07 13:28:27 +02:00
};
}