|
1 | 1 | {lib, ...}: let |
2 | 2 | inherit (lib.generators) mkLuaInline; |
3 | 3 | inherit (lib.options) mkOption mkEnableOption literalMD; |
4 | | - inherit (lib.types) attrs either nullOr; |
| 4 | + inherit (lib.types) attrs either nullOr listOf submodule str; |
5 | 5 | inherit (lib.nvim.lua) toLuaObject; |
6 | 6 | 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 | + }; |
7 | 47 | in { |
8 | 48 | options.vim.formatter.conform-nvim = { |
9 | 49 | enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]"; |
10 | 50 | setupOpts = mkPluginSetupOption "conform.nvim" { |
| 51 | + formatters = mkOption { |
| 52 | + type = formattersType; |
| 53 | + default = {}; |
| 54 | + description = "Custom formatters and overrides for built-in formatters."; |
| 55 | + }; |
11 | 56 | formatters_by_ft = mkOption { |
12 | 57 | type = attrs; |
13 | 58 | default = {}; |
|
0 commit comments