plugins: normalise null plugin-defaults

Replaced all instances of `"null"` with `null`, when passing
plugin-defaults to `defaultNullOpts` functions.
This commit is contained in:
Matt Sturgeon 2024-06-02 02:58:20 +01:00
parent e58380adcd
commit d136c08f3a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
17 changed files with 69 additions and 55 deletions

View file

@ -137,7 +137,7 @@ in
rightMouseCommand = helpers.defaultNullOpts.mkStr "bdelete! %d" "Command or function run when right clicking on a buffer."; rightMouseCommand = helpers.defaultNullOpts.mkStr "bdelete! %d" "Command or function run when right clicking on a buffer.";
middleMouseCommand = helpers.defaultNullOpts.mkStr "null" "Command or function run when middle clicking on a buffer."; middleMouseCommand = helpers.defaultNullOpts.mkStr null "Command or function run when middle clicking on a buffer.";
indicator = { indicator = {
icon = helpers.defaultNullOpts.mkStr "" "icon"; icon = helpers.defaultNullOpts.mkStr "" "icon";
@ -161,7 +161,7 @@ in
"thin" "thin"
] "thin" "Separator style"; ] "thin" "Separator style";
nameFormatter = helpers.defaultNullOpts.mkLuaFn "null" '' nameFormatter = helpers.defaultNullOpts.mkLuaFn null ''
A lua function that can be used to modify the buffer's label. A lua function that can be used to modify the buffer's label.
The argument 'buf' containing a name, path and bufnr is supplied. The argument 'buf' containing a name, path and bufnr is supplied.
''; '';
@ -178,7 +178,7 @@ in
showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons"; showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons";
getElementIcon = helpers.defaultNullOpts.mkLuaFn "null" '' getElementIcon = helpers.defaultNullOpts.mkLuaFn null ''
Lua function returning an element icon. Lua function returning an element icon.
``` ```
@ -210,11 +210,11 @@ in
]) ])
) "false" "diagnostics"; ) "false" "diagnostics";
diagnosticsIndicator = helpers.defaultNullOpts.mkLuaFn "null" "Either `null` or a function that returns the diagnostics indicator."; diagnosticsIndicator = helpers.defaultNullOpts.mkLuaFn null "Either `null` or a function that returns the diagnostics indicator.";
diagnosticsUpdateInInsert = helpers.defaultNullOpts.mkBool true "Whether diagnostics should update in insert mode"; diagnosticsUpdateInInsert = helpers.defaultNullOpts.mkBool true "Whether diagnostics should update in insert mode";
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets"; offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) null "offsets";
groups = { groups = {
items = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]" "List of groups."; items = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]" "List of groups.";
@ -236,7 +236,7 @@ in
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging"; logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
}; };
customFilter = helpers.defaultNullOpts.mkLuaFn "null" '' customFilter = helpers.defaultNullOpts.mkLuaFn null ''
``` ```
fun(buf: number, bufnums: number[]): boolean fun(buf: number, bufnums: number[]): boolean
``` ```

View file

@ -32,7 +32,7 @@ in
includeConfigs = helpers.defaultNullOpts.mkBool true "Add default configurations."; includeConfigs = helpers.defaultNullOpts.mkBool true "Add default configurations.";
resolvePython = helpers.defaultNullOpts.mkLuaFn "null" '' resolvePython = helpers.defaultNullOpts.mkLuaFn null ''
Function to resolve path to python to use for program or test execution. Function to resolve path to python to use for program or test execution.
By default the `VIRTUAL_ENV` and `CONDA_PREFIX` environment variables are used if present. By default the `VIRTUAL_ENV` and `CONDA_PREFIX` environment variables are used if present.
''; '';

View file

@ -185,7 +185,7 @@ in
"Maximum number of lines to allow a value to fill before trimming."; "Maximum number of lines to allow a value to fill before trimming.";
}; };
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" '' selectWindow = helpers.defaultNullOpts.mkLuaFn null ''
A function which returns a window to be used for opening buffers such as a stack frame location. A function which returns a window to be used for opening buffers such as a stack frame location.
''; '';
}; };

View file

@ -221,11 +221,11 @@ in
truncationCharacter = helpers.defaultNullOpts.mkStr "" "Character to use when truncating the tab label"; truncationCharacter = helpers.defaultNullOpts.mkStr "" "Character to use when truncating the tab label";
tabsMinWidth = tabsMinWidth =
helpers.defaultNullOpts.mkNullable types.int "null" helpers.defaultNullOpts.mkNullable types.int null
"If int padding is added based on `contentLayout`"; "If int padding is added based on `contentLayout`";
tabsMaxWidth = tabsMaxWidth =
helpers.defaultNullOpts.mkNullable types.int "null" helpers.defaultNullOpts.mkNullable types.int null
"This will truncate text even if `textTruncToFit = false`"; "This will truncate text even if `textTruncToFit = false`";
padding = helpers.defaultNullOpts.mkNullable (with types; either int (attrsOf int)) "0" '' padding = helpers.defaultNullOpts.mkNullable (with types; either int (attrsOf int)) "0" ''
@ -259,11 +259,11 @@ in
}; };
}) })
) )
null
'' ''
Set separators around the active tab. Set separators around the active tab.
null falls back to `sourceSelector.separator`. null falls back to `sourceSelector.separator`.
'' '';
"null";
showSeparatorOnEdge = helpers.defaultNullOpts.mkBool false '' showSeparatorOnEdge = helpers.defaultNullOpts.mkBool false ''
Takes a boolean value where `false` (default) hides the separators on the far Takes a boolean value where `false` (default) hides the separators on the far
@ -354,7 +354,7 @@ in
highlight = helpers.defaultNullOpts.mkStr "NeoTreeIndentMarker" ""; highlight = helpers.defaultNullOpts.mkStr "NeoTreeIndentMarker" "";
withExpanders = withExpanders =
helpers.defaultNullOpts.mkNullable types.bool "null" helpers.defaultNullOpts.mkNullable types.bool null
"If null and file nesting is enabled, will enable expanders."; "If null and file nesting is enabled, will enable expanders.";
expanderCollapsed = helpers.defaultNullOpts.mkStr "" ""; expanderCollapsed = helpers.defaultNullOpts.mkStr "" "";

View file

@ -9,7 +9,14 @@ with lib;
let let
cfg = config.plugins.diffview; cfg = config.plugins.diffview;
mkWinConfig = mkWinConfig =
type: width: height: position: with helpers.defaultNullOpts; { {
type ? null,
width ? null,
height ? null,
position ? null,
}:
with helpers.defaultNullOpts;
{
type = type =
mkEnum mkEnum
[ [
@ -294,7 +301,11 @@ in
${commonDesc} ${commonDesc}
''; '';
}; };
winConfig = mkWinConfig "split" 35 "" "left"; winConfig = mkWinConfig {
type = "split";
width = 35;
position = "left";
};
}; };
fileHistoryPanel = { fileHistoryPanel = {
logOptions = logOptions =
@ -427,11 +438,15 @@ in
multiFile = logOptions; multiFile = logOptions;
}; };
}; };
winConfig = mkWinConfig "split" "" 16 "bottom"; winConfig = mkWinConfig {
type = "split";
height = 16;
position = "bottom";
};
}; };
commitLogPanel = { commitLogPanel = {
winConfig = mkWinConfig "float" "" "" ""; winConfig = mkWinConfig { type = "float"; };
}; };
defaultArgs = defaultArgs =

View file

@ -23,7 +23,7 @@ in
"quickfix" "quickfix"
] "how to execute terminal commands"; ] "how to execute terminal commands";
onInitialized = helpers.defaultNullOpts.mkLuaFn "null" '' onInitialized = helpers.defaultNullOpts.mkLuaFn null ''
Callback to execute once rust-analyzer is done initializing the workspace Callback to execute once rust-analyzer is done initializing the workspace
The callback receives one parameter indicating the `health` of the server: The callback receives one parameter indicating the `health` of the server:
"ok" | "warning" | "error" "ok" | "warning" | "error"
@ -72,11 +72,11 @@ in
'' "rust-tools hover window" ""; '' "rust-tools hover window" "";
maxWidth = maxWidth =
helpers.defaultNullOpts.mkNullable types.int "null" helpers.defaultNullOpts.mkNullable types.int null
"Maximal width of the hover window. null means no max."; "Maximal width of the hover window. null means no max.";
maxHeight = maxHeight =
helpers.defaultNullOpts.mkNullable types.int "null" helpers.defaultNullOpts.mkNullable types.int null
"Maximal height of the hover window. null means no max."; "Maximal height of the hover window. null means no max.";
autoFocus = helpers.defaultNullOpts.mkBool false "whether the hover action window gets automatically focused"; autoFocus = helpers.defaultNullOpts.mkBool false "whether the hover action window gets automatically focused";
@ -88,13 +88,13 @@ in
see: https://graphviz.org/docs/outputs/ see: https://graphviz.org/docs/outputs/
''; '';
output = helpers.defaultNullOpts.mkStr "null" "where to store the output, nil for no output stored"; output = helpers.defaultNullOpts.mkStr null "where to store the output, nil for no output stored";
full = helpers.defaultNullOpts.mkBool true '' full = helpers.defaultNullOpts.mkBool true ''
true for all crates.io and external crates, false only the local crates true for all crates.io and external crates, false only the local crates
''; '';
enabledGraphvizBackends = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "null" '' enabledGraphvizBackends = helpers.defaultNullOpts.mkNullable (types.listOf types.str) null ''
List of backends found on: https://graphviz.org/docs/outputs/ List of backends found on: https://graphviz.org/docs/outputs/
Is used for input validation and autocompletion Is used for input validation and autocompletion
''; '';

View file

@ -25,11 +25,11 @@ with lib;
whether to display a `Renamed m instances in n files` message after a rename operation whether to display a `Renamed m instances in n files` message after a rename operation
''; '';
inputBufferType = helpers.defaultNullOpts.mkNullable (types.enum [ "dressing" ]) "null" '' inputBufferType = helpers.defaultNullOpts.mkNullable (types.enum [ "dressing" ]) null ''
the type of the external input buffer to use the type of the external input buffer to use
''; '';
postHook = helpers.defaultNullOpts.mkLuaFn "null" '' postHook = helpers.defaultNullOpts.mkLuaFn null ''
callback to run after renaming, receives the result table (from LSP handler) as an argument callback to run after renaming, receives the result table (from LSP handler) as an argument
''; '';
}; };

View file

@ -4,20 +4,20 @@
with lib; with lib;
{ {
formatting = { formatting = {
command = helpers.defaultNullOpts.mkListOf types.str "null" '' command = helpers.defaultNullOpts.mkListOf types.str null ''
External formatter command (with arguments). External formatter command (with arguments).
It should accepts file content in stdin and print the formatted code into stdout. It should accepts file content in stdin and print the formatted code into stdout.
''; '';
}; };
diagnostics = { diagnostics = {
ignored = helpers.defaultNullOpts.mkListOf types.str "[]" '' ignored = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Ignored diagnostic kinds. Ignored diagnostic kinds.
The kind identifier is a snake_cased_string usually shown together The kind identifier is a snake_cased_string usually shown together
with the diagnostic message. with the diagnostic message.
''; '';
excludedFiles = helpers.defaultNullOpts.mkListOf types.str "[]" '' excludedFiles = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Files to exclude from showing diagnostics. Useful for generated files. Files to exclude from showing diagnostics. Useful for generated files.
It accepts an array of paths. Relative paths are joint to the workspace root. It accepts an array of paths. Relative paths are joint to the workspace root.
Glob patterns are currently not supported. Glob patterns are currently not supported.

View file

@ -42,7 +42,7 @@ in
example = true; example = true;
}; };
border = helpers.defaultNullOpts.mkBorder "null" "`:NullLsInfo` UI window." '' border = helpers.defaultNullOpts.mkBorder null "`:NullLsInfo` UI window." ''
Uses `NullLsInfoBorder` highlight group (see [Highlight Groups](#highlight-groups)). Uses `NullLsInfoBorder` highlight group (see [Highlight Groups](#highlight-groups)).
''; '';
@ -80,7 +80,7 @@ in
Specifying a timeout with a value less than zero will prevent commands from timing out. Specifying a timeout with a value less than zero will prevent commands from timing out.
''; '';
diagnosticConfig = helpers.defaultNullOpts.mkNullable types.attrs "null" '' diagnosticConfig = helpers.defaultNullOpts.mkNullable types.attrs null ''
Specifies diagnostic display options for null-ls sources, as described in Specifies diagnostic display options for null-ls sources, as described in
`:help vim.diagnostic.config()`. `:help vim.diagnostic.config()`.
(null-ls uses separate namespaces for each source, so server-wide configuration will not work (null-ls uses separate namespaces for each source, so server-wide configuration will not work
@ -145,23 +145,23 @@ in
[nvim-notify](https://github.com/rcarriga/nvim-notify). [nvim-notify](https://github.com/rcarriga/nvim-notify).
''; '';
onAttach = helpers.defaultNullOpts.mkStr "null" '' onAttach = helpers.defaultNullOpts.mkStr null ''
Defines an `on_attach` callback to run whenever null-ls attaches to a buffer. Defines an `on_attach` callback to run whenever null-ls attaches to a buffer.
If you have a common `on_attach` you're using for LSP servers, you can reuse that here, use a If you have a common `on_attach` you're using for LSP servers, you can reuse that here, use a
custom callback for null-ls, or leave this undefined. custom callback for null-ls, or leave this undefined.
''; '';
onInit = helpers.defaultNullOpts.mkLuaFn "null" '' onInit = helpers.defaultNullOpts.mkLuaFn null ''
Defines an `on_init` callback to run when null-ls initializes. From here, you Defines an `on_init` callback to run when null-ls initializes. From here, you
can make changes to the client (the first argument) or `initialize_result` (the can make changes to the client (the first argument) or `initialize_result` (the
second argument, which as of now is not used). second argument, which as of now is not used).
''; '';
onExit = helpers.defaultNullOpts.mkLuaFn "null" '' onExit = helpers.defaultNullOpts.mkLuaFn null ''
Defines an `on_exit` callback to run when the null-ls client exits. Defines an `on_exit` callback to run when the null-ls client exits.
''; '';
rootDir = helpers.defaultNullOpts.mkLuaFn "null" '' rootDir = helpers.defaultNullOpts.mkLuaFn null ''
Determines the root of the null-ls server. On startup, null-ls will call Determines the root of the null-ls server. On startup, null-ls will call
`root_dir` with the full path to the first file that null-ls attaches to. `root_dir` with the full path to the first file that null-ls attaches to.
@ -175,7 +175,7 @@ in
directory. directory.
''; '';
shouldAttach = helpers.defaultNullOpts.mkLuaFn "null" '' shouldAttach = helpers.defaultNullOpts.mkLuaFn null ''
A user-defined function that controls whether to enable null-ls for a given A user-defined function that controls whether to enable null-ls for a given
buffer. Receives `bufnr` as its first argument. buffer. Receives `bufnr` as its first argument.
@ -191,7 +191,7 @@ in
``` ```
''; '';
tempDir = helpers.defaultNullOpts.mkStr "null" '' tempDir = helpers.defaultNullOpts.mkStr null ''
Defines the directory used to create temporary files for sources that rely on them (a Defines the directory used to create temporary files for sources that rely on them (a
workaround used for command-based sources that do not support `stdio`). workaround used for command-based sources that do not support `stdio`).

View file

@ -156,7 +156,7 @@ with lib;
hover = { hover = {
enabled = helpers.defaultNullOpts.mkBool true "enable hover UI"; enabled = helpers.defaultNullOpts.mkBool true "enable hover UI";
view = view =
helpers.defaultNullOpts.mkNullable types.str "null" helpers.defaultNullOpts.mkNullable types.str null
"when null, use defaults from documentation"; "when null, use defaults from documentation";
opts = opts =
helpers.defaultNullOpts.mkNullable types.anything "{}" helpers.defaultNullOpts.mkNullable types.anything "{}"
@ -176,7 +176,7 @@ with lib;
}; };
view = view =
helpers.defaultNullOpts.mkNullable types.str "null" helpers.defaultNullOpts.mkNullable types.str null
"when null, use defaults from documentation"; "when null, use defaults from documentation";
opts = opts =
helpers.defaultNullOpts.mkNullable types.anything "{}" helpers.defaultNullOpts.mkNullable types.anything "{}"

View file

@ -29,11 +29,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Whether to right-align the cursor line number with `relativenumber` set. Whether to right-align the cursor line number with `relativenumber` set.
''; '';
ft_ignore = helpers.defaultNullOpts.mkListOf types.str "null" '' ft_ignore = helpers.defaultNullOpts.mkListOf types.str null ''
Lua table with 'filetype' values for which `statuscolumn` will be unset. Lua table with 'filetype' values for which `statuscolumn` will be unset.
''; '';
bt_ignore = helpers.defaultNullOpts.mkListOf types.str "null" '' bt_ignore = helpers.defaultNullOpts.mkListOf types.str null ''
Lua table with 'buftype' values for which `statuscolumn` will be unset. Lua table with 'buftype' values for which `statuscolumn` will be unset.
''; '';

View file

@ -58,13 +58,13 @@ in
}; };
autoSave = { autoSave = {
enabled = helpers.defaultNullOpts.mkNullable types.bool "null" '' enabled = helpers.defaultNullOpts.mkNullable types.bool null ''
Whether to enable auto saving session. Whether to enable auto saving session.
''; '';
}; };
autoRestore = { autoRestore = {
enabled = helpers.defaultNullOpts.mkNullable types.bool "null" '' enabled = helpers.defaultNullOpts.mkNullable types.bool null ''
Whether to enable auto restoring session. Whether to enable auto restoring session.
''; '';
}; };

View file

@ -68,7 +68,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%). Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
''; '';
width = helpers.defaultNullOpts.mkNullable intOrRatio "null" '' width = helpers.defaultNullOpts.mkNullable intOrRatio null ''
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%). Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
''; '';
@ -130,7 +130,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Used to customize the layout. Used to customize the layout.
''; '';
get_config = helpers.defaultNullOpts.mkLuaFn "null" '' get_config = helpers.defaultNullOpts.mkLuaFn null ''
This can be a function that accepts the opts parameter that is passed in to 'vim.select' This can be a function that accepts the opts parameter that is passed in to 'vim.select'
or 'vim.input'. It must return either nil or config values to use in place of the global or 'vim.input'. It must return either nil or config values to use in place of the global
config values for that module. config values for that module.
@ -153,8 +153,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
''; '';
telescope = telescope =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either strLua (attrsOf anything)) helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either strLua (attrsOf anything)) null
"null"
'' ''
Options for telescope selector. Options for telescope selector.
@ -230,7 +229,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
} }
'' "An attribute set of window options."; '' "An attribute set of window options.";
width = helpers.defaultNullOpts.mkNullable intOrRatio "null" '' width = helpers.defaultNullOpts.mkNullable intOrRatio null ''
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%). Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
''; '';
@ -252,7 +251,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
of total." of total."
''; '';
height = helpers.defaultNullOpts.mkNullable intOrRatio "null" '' height = helpers.defaultNullOpts.mkNullable intOrRatio null ''
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%). Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
''; '';
@ -313,7 +312,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
``` ```
''; '';
get_config = helpers.defaultNullOpts.mkLuaFn "null" '' get_config = helpers.defaultNullOpts.mkLuaFn null ''
This can be a function that accepts the opts parameter that is passed in to 'vim.select' This can be a function that accepts the opts parameter that is passed in to 'vim.select'
or 'vim.input'. It must return either nil or config values to use in place of the global or 'vim.input'. It must return either nil or config values to use in place of the global
config values for that module. config values for that module.

View file

@ -22,7 +22,7 @@ with lib;
"warn" "warn"
"run" "run"
] ]
"null" null
'' ''
Decides what to do when a key which doesn't belong to any head is pressed Decides what to do when a key which doesn't belong to any head is pressed
- `null`: hydra exits and foreign key behaves normally, as if the hydra wasn't active - `null`: hydra exits and foreign key behaves normally, as if the hydra wasn't active
@ -37,14 +37,14 @@ with lib;
buffer = helpers.defaultNullOpts.mkNullable ( buffer = helpers.defaultNullOpts.mkNullable (
with types; either (enum [ true ]) ints.unsigned with types; either (enum [ true ]) ints.unsigned
) "null" "Define a hydra for the given buffer, pass `true` for current buf."; ) null "Define a hydra for the given buffer, pass `true` for current buf.";
invoke_on_body = helpers.defaultNullOpts.mkBool false '' invoke_on_body = helpers.defaultNullOpts.mkBool false ''
When true, summon the hydra after pressing only the `body` keys. When true, summon the hydra after pressing only the `body` keys.
Normally a head is required. Normally a head is required.
''; '';
desc = helpers.defaultNullOpts.mkStr "null" '' desc = helpers.defaultNullOpts.mkStr null ''
Description used for the body keymap when `invoke_on_body` is true. Description used for the body keymap when `invoke_on_body` is true.
When nil, "[Hydra] .. name" is used. When nil, "[Hydra] .. name" is used.
''; '';

View file

@ -51,7 +51,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"warn" "warn"
"error" "error"
] ]
"null" null
'' ''
Log messages at or above this level. Log messages at or above this level.
''; '';

View file

@ -20,7 +20,7 @@ in
while opening the folded line, `0` value will disable the highlight while opening the folded line, `0` value will disable the highlight
''; '';
providerSelector = helpers.defaultNullOpts.mkLuaFn "null" '' providerSelector = helpers.defaultNullOpts.mkLuaFn null ''
A lua function as a selector for fold providers. A lua function as a selector for fold providers.
''; '';
@ -31,7 +31,7 @@ in
run `UfoInspect` for details if your provider has extended the kinds. run `UfoInspect` for details if your provider has extended the kinds.
''; '';
foldVirtTextHandler = helpers.defaultNullOpts.mkLuaFn "null" "A lua function to customize fold virtual text"; foldVirtTextHandler = helpers.defaultNullOpts.mkLuaFn null "A lua function to customize fold virtual text";
enableGetFoldVirtText = helpers.defaultNullOpts.mkBool false '' enableGetFoldVirtText = helpers.defaultNullOpts.mkBool false ''
Enable a function with `lnum` as a parameter to capture the virtual text Enable a function with `lnum` as a parameter to capture the virtual text

View file

@ -49,7 +49,7 @@ in
"warn" "warn"
"error" "error"
] ]
"null" null
'' ''
Log messages at or above this level. Log messages at or above this level.
''; '';