Skip to content

Commit 0c0fe24

Browse files
committed
conform: add definitions for setupOpts.formatters
1 parent 85275d2 commit 0c0fe24

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

modules/plugins/formatter/conform-nvim/conform-nvim.nix

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,58 @@
11
{lib, ...}: let
22
inherit (lib.generators) mkLuaInline;
33
inherit (lib.options) mkOption mkEnableOption literalMD;
4-
inherit (lib.types) attrs either nullOr;
4+
inherit (lib.types) attrs either nullOr listOf submodule str;
55
inherit (lib.nvim.lua) toLuaObject;
66
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
7+
8+
formattersType = submodule {
9+
freeformType = attrs;
10+
options = {
11+
command = mkOption {
12+
type = nullOr (either str luaInline);
13+
default = null;
14+
description = "The command to run.";
15+
};
16+
17+
args = mkOption {
18+
type = nullOr (either (listOf str) luaInline);
19+
default = null;
20+
description = ''
21+
A list of strings, or a lua function that returns a list of strings.
22+
23+
Return a single string instead of a list to run the command in a
24+
shell.
25+
'';
26+
};
27+
28+
prepend_args = mkOption {
29+
type = nullOr (either (listOf str) luaInline);
30+
default = null;
31+
description = ''
32+
When inherit = true, add additional arguments to the beginning of
33+
args. Can also be a function, like args.
34+
'';
35+
};
36+
37+
append_args = mkOption {
38+
type = nullOr (either (listOf str) luaInline);
39+
default = null;
40+
description = ''
41+
When inherit = true, add additional arguments to the end of args.
42+
Can also be a function, like args.
43+
'';
44+
};
45+
};
46+
};
747
in {
848
options.vim.formatter.conform-nvim = {
949
enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]";
1050
setupOpts = mkPluginSetupOption "conform.nvim" {
51+
formatters = mkOption {
52+
type = formattersType;
53+
default = {};
54+
description = "Custom formatters and overrides for built-in formatters.";
55+
};
1156
formatters_by_ft = mkOption {
1257
type = attrs;
1358
default = {};

0 commit comments

Comments
 (0)