mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-01 16:45:55 +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.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
in {
|
||||
# TODO: remove
|
||||
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.dag) entryAnywhere;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.languages) setLanguageIndent;
|
||||
inherit (lib.trivial) warn;
|
||||
|
||||
cfg = config.vim.languages.markdown;
|
||||
|
|
@ -205,5 +206,11 @@ in {
|
|||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
(setLanguageIndent {
|
||||
language = "markdown";
|
||||
indentSize = 6;
|
||||
})
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,16 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (builtins) attrNames toString;
|
||||
inherit (lib) concatStringsSep;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.types) int;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.languages) setLanguageIndent;
|
||||
|
||||
cfg = config.vim.languages.nix;
|
||||
|
||||
|
|
@ -106,6 +108,12 @@ in {
|
|||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
|
||||
indentSize = mkOption {
|
||||
description = "Sets the indent size in spaces for .nix files";
|
||||
type = int;
|
||||
default = 10;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -160,5 +168,11 @@ in {
|
|||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
(setLanguageIndent {
|
||||
language = "nix";
|
||||
indentSize = cfg.indentSize;
|
||||
})
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue