mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-14 16:11: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,25 +8,50 @@
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.utility.surround;
|
cfg = config.vim.utility.surround;
|
||||||
|
vendoredKeybinds = {
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
mkLznKey = mode: key: {
|
||||||
|
inherit key mode;
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-surround"];
|
startPlugins = ["nvim-surround"];
|
||||||
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||||
|
|
||||||
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings {
|
lazy.plugins = [
|
||||||
insert = "<C-g>z";
|
{
|
||||||
insert_line = "<C-g>Z";
|
package = "nvim-surround";
|
||||||
normal = "gz";
|
setupModule = "nvim-surround";
|
||||||
normal_cur = "gZ";
|
inherit (cfg) setupOpts;
|
||||||
normal_line = "gzz";
|
|
||||||
normal_cur_line = "gZZ";
|
keys =
|
||||||
visual = "gz";
|
map (mkLznKey ["i"]) (with vendoredKeybinds; [insert insert_line])
|
||||||
visual_line = "gZ";
|
++ map (mkLznKey ["x"]) (with vendoredKeybinds; [visual visual_line])
|
||||||
delete = "gzd";
|
++ map (mkLznKey ["n"]) (with vendoredKeybinds; [
|
||||||
change = "gzr";
|
normal
|
||||||
change_line = "gZR";
|
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