modules/plugins: fix settings

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-06 12:32:33 +03:00
parent 8940daadb9
commit f95df25986
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 12 additions and 7 deletions

View file

@ -15,11 +15,12 @@ let cfg = config.plugins.gitsigns; in
keymap.set = mkOption {
type = with types; listOf keymap;
default = [ ];
};
};
config = lib.mkIf cfg.enable {
fn.gitsigns-nvim-on-attach = {
fn.gitsigns-nvim-on-attach = lib.mkIf (cfg.keymap.set != [ ]) {
args = [ "bufnr" ];
content = { bufnr }: {
vim.keymap.set = map (attrs: attrs // { buffer = bufnr; }) cfg.keymap.set;
@ -30,9 +31,12 @@ let cfg = config.plugins.gitsigns; in
name = "gitsigns";
varName = "gs";
package = cfg.package;
setupSettings = cfg.settings // {
setupSettings = lib.mkMerge [
cfg.settings
(lib.mkIf (cfg.keymap.set != [ ]) {
on_attach = config.fn.gitsigns-nvim-on-attach.lambda;
};
})
];
};
};
}

View file

@ -55,11 +55,12 @@ let cfg = config.plugins.navigation.nvim-tree; in
plugin.nvim-tree-lua = {
name = "nvim-tree";
package = cfg.package;
setupSettings =
setupSettings = lib.mkMerge [
cfg.settings
// lib.optionalAttrs (cfg.keymap.set != [ ]) {
(lib.mkIf (cfg.keymap.set != [ ]) {
on_attach = config.fn.nvim-tree-lua-on-attach.lambda;
};
})
];
};
vim.g = lib.mkIf cfg.disableNetrw {