mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-13 22:17:49 +00:00
languages: allow listOf format.type
This commit is contained in:
parent
e1f098a1b4
commit
7bbc3b536f
24 changed files with 312 additions and 353 deletions
|
|
@ -96,7 +96,7 @@
|
|||
formats = {
|
||||
# https://github.com/Enter-tainer/typstyle
|
||||
typstyle = {
|
||||
package = pkgs.typstyle;
|
||||
command = getExe pkgs.typstyle;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -122,16 +122,10 @@ in {
|
|||
enable = mkEnableOption "Typst document formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Typst formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Typst formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extensions = {
|
||||
|
|
@ -238,9 +232,14 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.typst = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
setupOpts = {
|
||||
formatters_by_ft.typst = cfg.format.type;
|
||||
formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue