mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-15 16:41:03 +00:00
surround-nvim: lazy load
This commit is contained in:
parent
6ae18403a8
commit
4701bb15c5
1 changed files with 38 additions and 13 deletions
|
|
@ -8,13 +8,7 @@
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.utility.surround;
|
cfg = config.vim.utility.surround;
|
||||||
in {
|
vendoredKeybinds = {
|
||||||
config = mkIf cfg.enable {
|
|
||||||
vim = {
|
|
||||||
startPlugins = ["nvim-surround"];
|
|
||||||
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
|
||||||
|
|
||||||
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings {
|
|
||||||
insert = "<C-g>z";
|
insert = "<C-g>z";
|
||||||
insert_line = "<C-g>Z";
|
insert_line = "<C-g>Z";
|
||||||
normal = "gz";
|
normal = "gz";
|
||||||
|
|
@ -27,6 +21,37 @@ in {
|
||||||
change = "gzr";
|
change = "gzr";
|
||||||
change_line = "gZR";
|
change_line = "gZR";
|
||||||
};
|
};
|
||||||
|
mkLznKey = mode: key: {
|
||||||
|
inherit key mode;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["nvim-surround"];
|
||||||
|
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||||
|
|
||||||
|
lazy.plugins = [
|
||||||
|
{
|
||||||
|
package = "nvim-surround";
|
||||||
|
setupModule = "nvim-surround";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
keys =
|
||||||
|
map (mkLznKey ["i"]) (with vendoredKeybinds; [insert insert_line])
|
||||||
|
++ map (mkLznKey ["x"]) (with vendoredKeybinds; [visual visual_line])
|
||||||
|
++ map (mkLznKey ["n"]) (with vendoredKeybinds; [
|
||||||
|
normal
|
||||||
|
normal_cur
|
||||||
|
normal_line
|
||||||
|
normal_cur_line
|
||||||
|
delete
|
||||||
|
change
|
||||||
|
change_line
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings vendoredKeybinds;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue