mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-09 04:07:16 +00:00
generic indent func
This commit is contained in:
parent
95f36449a7
commit
535d58afba
3 changed files with 35 additions and 0 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 = {
|
||||||
|
|
@ -80,4 +81,23 @@ in {
|
||||||
|
|
||||||
# maybe put generic function to set indent for provided langs
|
# maybe put generic function to set indent for provided langs
|
||||||
# Then we can just call it with the lib arg
|
# Then we can just call it with the lib arg
|
||||||
|
|
||||||
|
setLanguageIndent = {language, indentSize}: {
|
||||||
|
vim.autocmds = [
|
||||||
|
{
|
||||||
|
desc = "Sets indent for nix files";
|
||||||
|
event = ["BufEnter"];
|
||||||
|
pattern = [ "*.${language}" ];
|
||||||
|
callback = mkLuaInline ''
|
||||||
|
function()
|
||||||
|
vim.opt.tabstop = ${toString indentSize}
|
||||||
|
vim.opt.softtabstop = ${toString indentSize}
|
||||||
|
vim.opt.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 = "md";
|
||||||
|
indentSize = 4;
|
||||||
|
})
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
inherit (lib.types) int;
|
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;
|
||||||
|
|
||||||
|
|
@ -168,6 +169,12 @@ in {
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(setLanguageIndent {
|
||||||
|
language = "nix";
|
||||||
|
indentSize = cfg.indentSize;
|
||||||
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
vim.autocmds = [
|
vim.autocmds = [
|
||||||
{
|
{
|
||||||
|
|
@ -188,6 +195,7 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue