mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 19:05:55 +00:00
broken more granular indent options
This commit is contained in:
parent
7267cf3570
commit
a0d4238282
5 changed files with 33 additions and 17 deletions
|
|
@ -49,7 +49,12 @@ isMaximal: {
|
|||
enableExtraDiagnostics = true;
|
||||
|
||||
# Languages that will be supported in default and maximal configurations.
|
||||
nix.enable = true;
|
||||
nix = {
|
||||
enable = true;
|
||||
tabstop = 20;
|
||||
softtabstop = 20;
|
||||
shiftwidth = 20;
|
||||
};
|
||||
markdown.enable = true;
|
||||
|
||||
# Languages that are enabled in the maximal configuration.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
flake = {
|
||||
lib = {
|
||||
inherit (lib) nvim;
|
||||
inherit (lib) generators;
|
||||
inherit (lib.nvim) neovimConfiguration;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -82,17 +82,17 @@ in {
|
|||
# maybe put generic function to set indent for provided langs
|
||||
# Then we can just call it with the lib arg
|
||||
|
||||
setLanguageIndent = {language, indentSize}: {
|
||||
setLanguageIndent = {language, tabstop, softtabstop, shiftwidth}: {
|
||||
vim.autocmds = [
|
||||
{
|
||||
desc = "Sets indent for nix files";
|
||||
event = ["FileType"];
|
||||
event = [ "FileType" ];
|
||||
pattern = [ language ];
|
||||
callback = mkLuaInline ''
|
||||
function()
|
||||
vim.bo.tabstop = ${toString indentSize}
|
||||
vim.bo.softtabstop = ${toString indentSize}
|
||||
vim.bo.shiftwidth = ${toString indentSize}
|
||||
${if tabstop != null then "vim.bo.tabstop = " + toString tabstop else ""}
|
||||
${if softtabstop != null then "vim.bo.softtabstop = " + toString softtabstop else ""}
|
||||
${if shiftwidth != null then "vim.bo.shiftwidth = " + toString shiftwidth else ""}
|
||||
end
|
||||
'';
|
||||
once = true;
|
||||
|
|
|
|||
|
|
@ -207,10 +207,7 @@ in {
|
|||
};
|
||||
})
|
||||
|
||||
(setLanguageIndent {
|
||||
language = "markdown";
|
||||
indentSize = 6;
|
||||
})
|
||||
# todo
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.types) int;
|
||||
inherit (lib.types) enum int nullOr;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.languages) setLanguageIndent;
|
||||
|
|
@ -109,10 +108,22 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
indentSize = mkOption {
|
||||
description = "Sets the indent size in spaces for .nix files";
|
||||
type = int;
|
||||
default = 10;
|
||||
tabstop = mkOption {
|
||||
description = "Sets the tabstop size in spaces for .nix files";
|
||||
type = nullOr null;
|
||||
default = null;
|
||||
};
|
||||
|
||||
softtabstop = mkOption {
|
||||
description = "Sets the softtabstop size in spaces for .nix files";
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
};
|
||||
|
||||
shiftwidth = mkOption {
|
||||
description = "Sets the shiftwidth in spaces for .nix files";
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -171,7 +182,9 @@ in {
|
|||
|
||||
(setLanguageIndent {
|
||||
language = "nix";
|
||||
indentSize = cfg.indentSize;
|
||||
tabstop = cfg.tabstop;
|
||||
softtabstop = cfg.softtabstop;
|
||||
shiftwidth = cfg.shiftwidth;
|
||||
})
|
||||
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue