mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-07 11:17:15 +00:00
Merge 78066496b2 into ef1f22efaf
This commit is contained in:
commit
85195287ec
3 changed files with 45 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
inherit (lib.types) listOf bool str submodule attrsOf anything either nullOr uniq;
|
inherit (lib.types) listOf bool str submodule attrsOf anything either nullOr uniq;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
inherit (lib.nvim.types) luaInline;
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
# TODO: remove
|
# TODO: remove
|
||||||
diagnosticsToLua = {
|
diagnosticsToLua = {
|
||||||
|
|
@ -77,4 +78,26 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# maybe put generic function to set indent for provided langs
|
||||||
|
# Then we can just call it with the lib arg
|
||||||
|
|
||||||
|
setLanguageIndent = {language, indentSize}: {
|
||||||
|
vim.autocmds = [
|
||||||
|
{
|
||||||
|
desc = "Sets indent for nix files";
|
||||||
|
event = ["FileType"];
|
||||||
|
pattern = [ language ];
|
||||||
|
callback = mkLuaInline ''
|
||||||
|
function()
|
||||||
|
vim.bo.tabstop = ${toString indentSize}
|
||||||
|
vim.bo.softtabstop = ${toString indentSize}
|
||||||
|
vim.bo.shiftwidth = ${toString indentSize}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
once = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
inherit (lib.nvim.languages) setLanguageIndent;
|
||||||
inherit (lib.trivial) warn;
|
inherit (lib.trivial) warn;
|
||||||
|
|
||||||
cfg = config.vim.languages.markdown;
|
cfg = config.vim.languages.markdown;
|
||||||
|
|
@ -205,5 +206,11 @@ in {
|
||||||
cfg.extraDiagnostics.types);
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(setLanguageIndent {
|
||||||
|
language = "markdown";
|
||||||
|
indentSize = 6;
|
||||||
|
})
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,16 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames toString;
|
||||||
inherit (lib) concatStringsSep;
|
inherit (lib) concatStringsSep;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum;
|
inherit (lib.types) enum;
|
||||||
|
inherit (lib.types) int;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
inherit (lib.nvim.languages) setLanguageIndent;
|
||||||
|
|
||||||
cfg = config.vim.languages.nix;
|
cfg = config.vim.languages.nix;
|
||||||
|
|
||||||
|
|
@ -106,6 +108,12 @@ in {
|
||||||
inherit defaultDiagnosticsProvider;
|
inherit defaultDiagnosticsProvider;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
indentSize = mkOption {
|
||||||
|
description = "Sets the indent size in spaces for .nix files";
|
||||||
|
type = int;
|
||||||
|
default = 10;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -160,5 +168,11 @@ in {
|
||||||
cfg.extraDiagnostics.types);
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(setLanguageIndent {
|
||||||
|
language = "nix";
|
||||||
|
indentSize = cfg.indentSize;
|
||||||
|
})
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue