modules/fn: use content instead of settings

move content to content.extra
This commit is contained in:
Dmitriy Pleshevskiy 2024-05-01 02:01:47 +03:00
parent 238e4bf68e
commit 688e8e2ece
Signed by: pleshevskiy
GPG Key ID: 17041163DA10A9A2
2 changed files with 9 additions and 7 deletions

View File

@ -9,12 +9,14 @@ let
default = [ ];
};
content = mkOption {
type = with types; nullOr attrs;
default = null;
};
settings = mkOption {
type = types.functionTo (lib.types.submoduleWith {
modules = [
{
options.extra = with lib; mkOption {
type = with types; nullOr attrs;
default = null;
};
}
./vim/keymap.nix
# ./vim/opts.nix
];
@ -34,10 +36,10 @@ let
lambda = with lib.nix2lua;
let
fnArgs = builtins.listToAttrs (map (v: { name = v; value = raw v; }) config.args);
innerCfg = config.settings fnArgs;
innerCfg = config.content fnArgs;
in
lambda config.args (lib.flatten [
config.content
innerCfg.extra
(lib.flip map innerCfg.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars:
let

View File

@ -21,7 +21,7 @@ let cfg = config.plugins.gitsigns; in
config = lib.mkIf cfg.enable {
fn.gitsigns-nvim-on-attach = {
args = [ "bufnr" ];
settings = { bufnr }: {
content = { bufnr }: {
vim.keymap.set = map (attrs: attrs // { buffer = bufnr; }) cfg.keymap.set;
};
};