lib: remove nixvimTypes alias

This commit is contained in:
Matt Sturgeon 2024-09-27 08:07:20 +01:00
parent bafc6308f6
commit 2f49c76a6a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
59 changed files with 261 additions and 278 deletions

View file

@ -120,13 +120,18 @@ lib.fix (
wrapVimscriptForLua wrapVimscriptForLua
; ;
# TODO: Removed 2024-09-27
maintainers = throw "The `maintainers` alias has been removed. Use `lib.maintainers` on a lib with nixvim's extensions.";
# TODO: Deprecate the old `nixvimTypes` alias?
nixvimTypes = self.extendedLib.types;
toLuaObject = self.lua.toLua; toLuaObject = self.lua.toLua;
mkLuaInline = self.lua.mkInline; mkLuaInline = self.lua.mkInline;
} }
//
# TODO: Removed 2024-09-27; remove after 24.11
lib.mapAttrs
(
old: new:
throw "The `${old}` alias has been removed. Use `${new}` on a lib with nixvim's extensions."
)
{
maintainers = "lib.maintainers";
nixvimTypes = "lib.types";
}
) )

View file

@ -114,7 +114,7 @@
} }
// lib.optionalAttrs hasConfigAttrs { // lib.optionalAttrs hasConfigAttrs {
luaConfig = lib.mkOption { luaConfig = lib.mkOption {
type = lib.nixvim.nixvimTypes.pluginLuaConfig; type = lib.types.pluginLuaConfig;
default = { }; default = { };
description = "The plugin's lua configuration"; description = "The plugin's lua configuration";
}; };

View file

@ -8,7 +8,7 @@ let
commandAttributes = lib.types.submodule { commandAttributes = lib.types.submodule {
options = { options = {
command = lib.mkOption { command = lib.mkOption {
type = with helpers.nixvimTypes; either str rawLua; type = with lib.types; either str rawLua;
description = "The command to run."; description = "The command to run.";
}; };
@ -24,7 +24,7 @@ let
'' ''
The number of arguments to expect, see :h command-nargs. The number of arguments to expect, see :h command-nargs.
''; '';
complete = helpers.mkNullOrOption (with lib.types; either str helpers.nixvimTypes.rawLua) '' complete = helpers.mkNullOrOption (with lib.types; either str rawLua) ''
Tab-completion behaviour, see :h command-complete. Tab-completion behaviour, see :h command-complete.
''; '';
range = range =

View file

@ -15,7 +15,7 @@ let
# Raw filetype # Raw filetype
str str
# Function to set the filetype # Function to set the filetype
helpers.nixvimTypes.rawLua rawLua
# ["filetype" {priority = xx;}] # ["filetype" {priority = xx;}]
(listOf ( (listOf (
either str (submodule { either str (submodule {

View file

@ -7,7 +7,7 @@
{ {
options = { options = {
highlight = lib.mkOption { highlight = lib.mkOption {
type = lib.types.attrsOf helpers.nixvimTypes.highlight; type = lib.types.attrsOf lib.types.highlight;
default = { }; default = { };
description = "Define new highlight groups"; description = "Define new highlight groups";
example = { example = {
@ -16,7 +16,7 @@
}; };
highlightOverride = lib.mkOption { highlightOverride = lib.mkOption {
type = lib.types.attrsOf helpers.nixvimTypes.highlight; type = lib.types.attrsOf lib.types.highlight;
default = { }; default = { };
description = "Define highlight groups to override existing highlight"; description = "Define highlight groups to override existing highlight";
example = { example = {

View file

@ -59,7 +59,7 @@ mkVimPlugin {
name: name:
nameValuePair "section_${name}" ( nameValuePair "section_${name}" (
helpers.mkNullOrOption ( helpers.mkNullOrOption (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
rawLua rawLua
str str
@ -111,7 +111,7 @@ mkVimPlugin {
detect_spelllang = detect_spelllang =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
( (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
rawLua rawLua
intFlag intFlag
@ -179,47 +179,45 @@ mkVimPlugin {
If you want to use plain ascii symbols, set this variable: > If you want to use plain ascii symbols, set this variable: >
''; '';
mode_map = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (attrsOf str)) '' mode_map = helpers.mkNullOrOption (with lib.types; maybeRaw (attrsOf str)) ''
Define the set of text to display for each mode. Define the set of text to display for each mode.
Default: see source Default: see source
''; '';
exclude_filenames = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) '' exclude_filenames = helpers.mkNullOrOption (with lib.types; maybeRaw (listOf str)) ''
Define the set of filename match queries which excludes a window from having its Define the set of filename match queries which excludes a window from having its
statusline modified. statusline modified.
Default: see source for current list Default: see source for current list
''; '';
exclude_filetypes = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) '' exclude_filetypes = helpers.mkNullOrOption (with lib.types; maybeRaw (listOf str)) ''
Define the set of filetypes which are excluded from having its window statusline modified. Define the set of filetypes which are excluded from having its window statusline modified.
Default: see source for current list Default: see source for current list
''; '';
filetype_overrides = filetype_overrides = helpers.mkNullOrOption (with lib.types; maybeRaw (attrsOf (listOf str))) ''
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (attrsOf (listOf str))) Define the set of names to be displayed instead of a specific filetypes.
''
Define the set of names to be displayed instead of a specific filetypes.
Example: Example:
```nix ```nix
{ {
coc-explorer = ["CoC Explorer" ""]; coc-explorer = ["CoC Explorer" ""];
defx = ["defx" "%{b:defx.paths[0]}"]; defx = ["defx" "%{b:defx.paths[0]}"];
fugitive = ["fugitive" "%{airline#util#wrap(airline#extensions#branch#get_head(),80)}"]; fugitive = ["fugitive" "%{airline#util#wrap(airline#extensions#branch#get_head(),80)}"];
gundo = ["Gundo" "" ]; gundo = ["Gundo" "" ];
help = ["Help" "%f"]; help = ["Help" "%f"];
minibufexpl = ["MiniBufExplorer" ""]; minibufexpl = ["MiniBufExplorer" ""];
startify = ["startify" ""]; startify = ["startify" ""];
vim-plug = ["Plugins" ""]; vim-plug = ["Plugins" ""];
vimfiler = ["vimfiler" "%{vimfiler#get_status_string()}"]; vimfiler = ["vimfiler" "%{vimfiler#get_status_string()}"];
vimshell = ["vimshell" "%{vimshell#get_status_string()}"]; vimshell = ["vimshell" "%{vimshell#get_status_string()}"];
vaffle = ["Vaffle" "%{b:vaffle.dir}"]; vaffle = ["Vaffle" "%{b:vaffle.dir}"];
} }
``` ```
''; '';
exclude_preview = helpers.defaultNullOpts.mkFlagInt 0 '' exclude_preview = helpers.defaultNullOpts.mkFlagInt 0 ''
Defines whether the preview window should be excluded from having its window statusline Defines whether the preview window should be excluded from having its window statusline

View file

@ -5,8 +5,8 @@
... ...
}: }:
let let
inherit (lib.nixvim) defaultNullOpts nixvimTypes mkSettingsRenamedOptionModules; inherit (lib) types;
types = nixvimTypes; inherit (lib.nixvim) defaultNullOpts mkSettingsRenamedOptionModules;
in in
lib.nixvim.neovim-plugin.mkNeovimPlugin { lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "bufferline"; name = "bufferline";

View file

@ -13,7 +13,7 @@ let
imgDir = imgDir =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
( (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
str str
(listOf str) (listOf str)
@ -29,7 +29,7 @@ let
''; '';
imgDirTxt = helpers.defaultNullOpts.mkNullable ( imgDirTxt = helpers.defaultNullOpts.mkNullable (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
str str
(listOf str) (listOf str)

View file

@ -42,13 +42,13 @@ in
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.
''; '';
testRunner = helpers.mkNullOrOption (types.either types.str helpers.nixvimTypes.rawLua) '' testRunner = helpers.mkNullOrOption (types.either types.str types.rawLua) ''
The name of test runner to use by default. The name of test runner to use by default.
The default value is dynamic and depends on `pytest.ini` or `manage.py` markers. The default value is dynamic and depends on `pytest.ini` or `manage.py` markers.
If neither is found "unittest" is used. If neither is found "unittest" is used.
''; '';
testRunners = helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf strLuaFn) '' testRunners = helpers.mkNullOrOption (with lib.types; attrsOf strLuaFn) ''
Set to register test runners. Set to register test runners.
Built-in are test runners for unittest, pytest and django. Built-in are test runners for unittest, pytest and django.
The key is the test runner name, the value a function to generate the The key is the test runner name, the value a function to generate the

View file

@ -44,7 +44,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
settingsOptions = { settingsOptions = {
keymaps = keymaps =
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; attrsOf (either str rawLua)) helpers.defaultNullOpts.mkAttrsOf (with lib.types; attrsOf (either str rawLua))
{ {
normal = { normal = {
plain_below = "g?p"; plain_below = "g?p";

View file

@ -136,7 +136,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
in in
helpers.mkNullOrOption' { helpers.mkNullOrOption' {
type = type =
with helpers.nixvimTypes; with lib.types;
either strLua (submodule { either strLua (submodule {
freeformType = attrsOf anything; freeformType = attrsOf anything;
options = { options = {
@ -181,7 +181,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
# This option accepts an attrs or a lua string. # This option accepts an attrs or a lua string.
# Hence, we convert the string to raw lua in `apply`. # Hence, we convert the string to raw lua in `apply`.
keys = helpers.defaultNullOpts.mkAttrsOf' { keys = helpers.defaultNullOpts.mkAttrsOf' {
type = with helpers.nixvimTypes; either strLuaFn (enum [ false ]); type = with lib.types; either strLuaFn (enum [ false ]);
apply = x: if x == null then null else mapAttrs (_: v: if isString v then helpers.mkRaw v else v) x; apply = x: if x == null then null else mapAttrs (_: v: if isString v then helpers.mkRaw v else v) x;
description = '' description = ''
Buffer-local keymaps to be added to edgebar buffers. Buffer-local keymaps to be added to edgebar buffers.

View file

@ -16,7 +16,7 @@ let
with types; with types;
oneOf [ oneOf [
str str
helpers.nixvimTypes.rawLua rawLua
(listOf str) (listOf str)
(attrsOf (either str ints.unsigned)) (attrsOf (either str ints.unsigned))
] ]

View file

@ -5,8 +5,8 @@
... ...
}: }:
let let
inherit (lib) types;
inherit (lib.nixvim) defaultNullOpts; inherit (lib.nixvim) defaultNullOpts;
types = lib.nixvim.nixvimTypes;
in in
lib.nixvim.neovim-plugin.mkNeovimPlugin { lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "firenvim"; name = "firenvim";

View file

@ -4,8 +4,8 @@
... ...
}: }:
let let
inherit (lib) types;
inherit (lib.nixvim) defaultNullOpts; inherit (lib.nixvim) defaultNullOpts;
types = lib.nixvim.nixvimTypes;
in in
lib.nixvim.neovim-plugin.mkNeovimPlugin { lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "gitblame"; name = "gitblame";

View file

@ -24,8 +24,7 @@ with lib;
''; '';
actionCallback = actionCallback =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua) helpers.defaultNullOpts.mkNullable (with types; either str rawLua) "copy_to_clipboard"
"copy_to_clipboard"
'' ''
Callback for what to do with the url. Callback for what to do with the url.

View file

@ -58,14 +58,14 @@ with lib;
freeformType = with types; attrsOf anything; freeformType = with types; attrsOf anything;
options = { options = {
toplevel = mkOption { toplevel = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = '' description = ''
Path to the top-level of the parent git repository. Path to the top-level of the parent git repository.
''; '';
}; };
gitdir = mkOption { gitdir = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = '' description = ''
Path to the git directory of the parent git repository (typically the `.git/` directory). Path to the git directory of the parent git repository (typically the `.git/` directory).
''; '';

View file

@ -10,7 +10,7 @@ let
''; '';
mode = helpers.defaultNullOpts.mkNullable ( mode = helpers.defaultNullOpts.mkNullable (
with helpers.nixvimTypes; either helpers.keymaps.modeEnum (listOf helpers.keymaps.modeEnum) with lib.types; either helpers.keymaps.modeEnum (listOf helpers.keymaps.modeEnum)
) "n" "Modes where the hydra exists, same as `vim.keymap.set()` accepts."; ) "n" "Modes where the hydra exists, same as `vim.keymap.set()` accepts.";
body = helpers.mkNullOrStr '' body = helpers.mkNullOrStr ''
@ -75,12 +75,12 @@ let
''; '';
mode = helpers.mkNullOrOption ( mode = helpers.mkNullOrOption (
with helpers.nixvimTypes; either helpers.keymaps.modeEnum (listOf helpers.keymaps.modeEnum) with lib.types; either helpers.keymaps.modeEnum (listOf helpers.keymaps.modeEnum)
) "Override `mode` for this head."; ) "Override `mode` for this head.";
}; };
}; };
headType = headType =
with helpers.nixvimTypes; with lib.types;
# More precisely, a tuple: [head action opts] # More precisely, a tuple: [head action opts]
listOf ( listOf (
nullOr ( nullOr (

View file

@ -129,7 +129,7 @@ with lib;
''; '';
funcs = mkOption { funcs = mkOption {
type = with helpers.nixvimTypes; attrsOf strLuaFn; type = with lib.types; attrsOf strLuaFn;
description = '' description = ''
Table from function names to function. Table from function names to function.
Functions should return a string. Functions should return a string.

View file

@ -21,7 +21,7 @@ helpers.vim-plugin.mkVimPlugin {
See [here](https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators) for the list of available callbacks. See [here](https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators) for the list of available callbacks.
''; '';
type = type =
with helpers.nixvimTypes; with lib.types;
listOf (submodule { listOf (submodule {
options = { options = {
key = mkOption { key = mkOption {
@ -34,7 +34,7 @@ helpers.vim-plugin.mkVimPlugin {
action = mkOption { action = mkOption {
type = type =
with helpers.nixvimTypes; with lib.types;
maybeRaw ( maybeRaw (
# https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators # https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators
enum [ enum [

View file

@ -90,7 +90,7 @@ in
}; };
safeLabels = safeLabels =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; maybeRaw (listOf str)) helpers.defaultNullOpts.mkNullable (with lib.types; maybeRaw (listOf str))
(stringToCharacters "sfnut/SFNLHMUGT?Z") (stringToCharacters "sfnut/SFNLHMUGT?Z")
'' ''
When the number of matches does not exceed the number of these "safe" labels plus one, the When the number of matches does not exceed the number of these "safe" labels plus one, the

View file

@ -41,7 +41,7 @@ let
}; };
args = { args = {
type = listOf (either str helpers.nixvimTypes.rawLua); type = listOf (either str rawLua);
description = '' description = ''
List of arguments. List of arguments.
Can contain functions with zero arguments that will be evaluated once the linter is used. Can contain functions with zero arguments that will be evaluated once the linter is used.
@ -86,7 +86,7 @@ let
}; };
parser = { parser = {
type = helpers.nixvimTypes.strLuaFn; type = lib.types.strLuaFn;
description = "The code for your parser function."; description = "The code for your parser function.";
example = '' example = ''
require('lint.parser').from_pattern(pattern, groups, severity_map, defaults, opts) require('lint.parser').from_pattern(pattern, groups, severity_map, defaults, opts)
@ -211,7 +211,7 @@ in
}; };
callback = mkOption { callback = mkOption {
type = with types; nullOr (either str helpers.nixvimTypes.rawLua); type = with types; nullOr (either str rawLua);
default = defaultCallback; default = defaultCallback;
description = "What action to perform for linting"; description = "What action to perform for linting";
}; };

View file

@ -23,7 +23,7 @@ let
paths = paths =
helpers.mkNullOrOption helpers.mkNullOrOption
( (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
str str
path path
@ -39,11 +39,11 @@ let
List of paths to load. List of paths to load.
''; '';
exclude = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf (maybeRaw str))) '' exclude = helpers.mkNullOrOption (with lib.types; maybeRaw (listOf (maybeRaw str))) ''
List of languages to exclude, by default is empty. List of languages to exclude, by default is empty.
''; '';
include = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf (maybeRaw str))) '' include = helpers.mkNullOrOption (with lib.types; maybeRaw (listOf (maybeRaw str))) ''
List of languages to include, by default is not set. List of languages to include, by default is not set.
''; '';
}; };

View file

@ -75,7 +75,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
default_register = default_register =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either str (listOf str)) "\"" helpers.defaultNullOpts.mkNullable (with lib.types; either str (listOf str)) "\""
'' ''
What register to use by default when not specified (e.g. `Telescope neoclip`). What register to use by default when not specified (e.g. `Telescope neoclip`).
Can be a string such as `"\""` (single register) or a table of strings such as Can be a string such as `"\""` (single register) or a table of strings such as

View file

@ -26,11 +26,11 @@ in
timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 "Default timeout for notification."; timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 "Default timeout for notification.";
maxWidth = helpers.mkNullOrOption (with types; either ints.unsigned helpers.nixvimTypes.rawLua) '' maxWidth = helpers.mkNullOrOption (with types; either ints.unsigned rawLua) ''
Max number of columns for messages. Max number of columns for messages.
''; '';
maxHeight = helpers.mkNullOrOption (with types; either ints.unsigned helpers.nixvimTypes.rawLua) '' maxHeight = helpers.mkNullOrOption (with types; either ints.unsigned rawLua) ''
Max number of lines for a message. Max number of lines for a message.
''; '';

View file

@ -53,7 +53,7 @@ in
''; '';
data = mkOption { data = mkOption {
type = helpers.nixvimTypes.maybeRaw (with types; nullOr str); type = with types; nullOr (maybeRaw str);
default = null; default = null;
example = "/home/YOUR_USERNAME/.cache/jdtls/workspace"; example = "/home/YOUR_USERNAME/.cache/jdtls/workspace";
description = '' description = ''
@ -64,7 +64,7 @@ in
}; };
configuration = mkOption { configuration = mkOption {
type = helpers.nixvimTypes.maybeRaw (with types; nullOr str); type = with types; nullOr (maybeRaw str);
default = null; default = null;
example = "/home/YOUR_USERNAME/.cache/jdtls/config"; example = "/home/YOUR_USERNAME/.cache/jdtls/config";
description = "Path to the configuration file."; description = "Path to the configuration file.";

View file

@ -323,9 +323,7 @@ in
}; };
onAttach = onAttach =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable (with types; either (enum [ "default" ]) rawLua) "default"
(with types; either (enum [ "default" ]) helpers.nixvimTypes.rawLua)
"default"
'' ''
Function ran when creating the nvim-tree buffer. Function ran when creating the nvim-tree buffer.
This can be used to attach keybindings to the tree buffer. This can be used to attach keybindings to the tree buffer.
@ -387,7 +385,7 @@ in
''; '';
padding = padding =
helpers.defaultNullOpts.mkNullable (either ints.unsigned helpers.nixvimTypes.rawLua) "1" helpers.defaultNullOpts.mkNullable (either ints.unsigned rawLua) "1"
"Extra padding to the right."; "Extra padding to the right.";
}; };
}) })
@ -503,7 +501,7 @@ in
oneOf [ oneOf [
str str
bool bool
helpers.nixvimTypes.rawLua rawLua
] ]
) )
# Default # Default

View file

@ -214,12 +214,12 @@ helpers.neovim-plugin.mkNeovimPlugin {
types.submodule { types.submodule {
options = { options = {
name = mkOption { name = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = "The name for this workspace"; description = "The name for this workspace";
}; };
path = mkOption { path = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = "The of the workspace."; description = "The of the workspace.";
}; };

View file

@ -31,7 +31,7 @@ with lib;
''; '';
substitutions = helpers.defaultNullOpts.mkAttrsOf ( substitutions = helpers.defaultNullOpts.mkAttrsOf (
with helpers.nixvimTypes; either str rawLua with lib.types; either str rawLua
) { } "A map for custom variables, the key should be the variable and the value a function."; ) { } "A map for custom variables, the key should be the variable and the value a function.";
}; };
@ -224,7 +224,7 @@ with lib;
attrsOf (submodule { attrsOf (submodule {
options = { options = {
action = mkOption { action = mkOption {
type = helpers.nixvimTypes.strLua; type = lib.types.strLua;
description = "The lua code for this keymap action."; description = "The lua code for this keymap action.";
apply = helpers.mkRaw; apply = helpers.mkRaw;
}; };
@ -372,12 +372,12 @@ with lib;
submodule { submodule {
options = { options = {
char = mkOption { char = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = "The character to use for this checkbox."; description = "The character to use for this checkbox.";
}; };
hl_group = mkOption { hl_group = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = "The name of the highlight group to use for this checkbox."; description = "The name of the highlight group to use for this checkbox.";
}; };
}; };
@ -447,7 +447,7 @@ with lib;
''; '';
}; };
hl_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight { hl_groups = helpers.defaultNullOpts.mkAttrsOf lib.types.highlight {
ObsidianTodo = { ObsidianTodo = {
bold = true; bold = true;
fg = "#f78c6c"; fg = "#f78c6c";

View file

@ -210,7 +210,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
columns = mkOption { columns = mkOption {
type = type =
with helpers.nixvimTypes; with lib.types;
listOf (oneOf [ listOf (oneOf [
str str
(attrsOf anything) (attrsOf anything)

View file

@ -10,7 +10,7 @@ let
cfg = config.plugins.ollama; cfg = config.plugins.ollama;
actionOptionType = actionOptionType =
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
rawLua rawLua
(enum [ (enum [
@ -78,7 +78,7 @@ in
let let
promptOptions = { promptOptions = {
prompt = mkOption { prompt = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = '' description = ''
The prompt to send to the model. The prompt to send to the model.
@ -112,8 +112,7 @@ in
''; '';
extract = extract =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable (with lib.types; maybeRaw (either str (enum [ false ])))
(with helpers.nixvimTypes; maybeRaw (either str (enum [ false ])))
"```$ftype\n(.-)```" "```$ftype\n(.-)```"
'' ''
A `string.match` pattern to use for an Action to extract the output from the response A `string.match` pattern to use for an Action to extract the output from the response

View file

@ -119,7 +119,7 @@ in
# Rich presence text options. # Rich presence text options.
editingText = editingText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Editing %s" helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Editing %s"
'' ''
String rendered when an editable file is loaded in the buffer. String rendered when an editable file is loaded in the buffer.
@ -128,7 +128,7 @@ in
''; '';
fileExplorerText = fileExplorerText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Browsing %s" helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Browsing %s"
'' ''
String rendered when browsing a file explorer. String rendered when browsing a file explorer.
@ -137,8 +137,7 @@ in
''; '';
gitCommitText = gitCommitText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Committing changes"
"Committing changes"
'' ''
String rendered when committing changes in git. String rendered when committing changes in git.
@ -147,8 +146,7 @@ in
''; '';
pluginManagerText = pluginManagerText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Managing plugins"
"Managing plugins"
'' ''
String rendered when managing plugins. String rendered when managing plugins.
@ -157,7 +155,7 @@ in
''; '';
readingText = readingText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Reading %s" helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Reading %s"
'' ''
String rendered when a read-only/unmodifiable file is loaded into the buffer. String rendered when a read-only/unmodifiable file is loaded into the buffer.
@ -166,8 +164,7 @@ in
''; '';
workspaceText = workspaceText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Working on %s"
"Working on %s"
'' ''
String rendered when in a git repository. String rendered when in a git repository.
@ -176,8 +173,7 @@ in
''; '';
lineNumberText = lineNumberText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Line %s out of %s"
"Line %s out of %s"
'' ''
String rendered when `enableLineNumber` is set to `true` to display the current line number. String rendered when `enableLineNumber` is set to `true` to display the current line number.

View file

@ -39,7 +39,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ]; plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ];
}; };
settingsOptions = with helpers.nixvimTypes; { settingsOptions = with lib.types; {
prompt_func_return_type = prompt_func_return_type =
helpers.defaultNullOpts.mkAttrsOf bool helpers.defaultNullOpts.mkAttrsOf bool
{ {

View file

@ -327,7 +327,7 @@ with lib;
executable = { executable = {
command = helpers.mkNullOrStr "The command for the executable."; command = helpers.mkNullOrStr "The command for the executable.";
args = helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf str)) '' args = helpers.mkNullOrOption (with lib.types; maybeRaw (listOf str)) ''
Its arguments. Its arguments.
''; '';
}; };

View file

@ -18,20 +18,20 @@ helpers.vim-plugin.mkVimPlugin {
freeformType = with types; attrsOf anything; freeformType = with types; attrsOf anything;
options = { options = {
name = mkOption { name = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = "The name of the schema."; description = "The name of the schema.";
}; };
description = helpers.mkNullOrStr "A description for this schema."; description = helpers.mkNullOrStr "A description for this schema.";
fileMatch = fileMatch =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (either str (listOf (maybeRaw str)))) helpers.mkNullOrOption (with lib.types; maybeRaw (either str (listOf (maybeRaw str))))
'' ''
Which filename to match against for this schema. Which filename to match against for this schema.
''; '';
url = mkOption { url = mkOption {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
description = "The URL of this schema."; description = "The URL of this schema.";
}; };
}; };

View file

@ -7,7 +7,7 @@ with lib;
lists = mkOption { lists = mkOption {
type = type =
with helpers.nixvimTypes; with lib.types;
listOf ( listOf (
either strLua (submodule { either strLua (submodule {
freeformType = with types; attrsOf anything; freeformType = with types; attrsOf anything;
@ -18,12 +18,12 @@ with lib;
example = "files"; example = "files";
}; };
header = helpers.mkNullOrOption (with helpers.nixvimTypes; listOf (maybeRaw str)) '' header = helpers.mkNullOrOption (with lib.types; listOf (maybeRaw str)) ''
The 'header' is a list of strings, whereas each string will be put on its own The 'header' is a list of strings, whereas each string will be put on its own
line in the header. line in the header.
''; '';
indices = helpers.mkNullOrOption (with helpers.nixvimTypes; listOf (maybeRaw str)) '' indices = helpers.mkNullOrOption (with lib.types; listOf (maybeRaw str)) ''
The 'indices' is a list of strings, which act as indices for the current list. The 'indices' is a list of strings, which act as indices for the current list.
Opposed to the global `custom_indices`, this is limited to the current list. Opposed to the global `custom_indices`, this is limited to the current list.
''; '';
@ -67,7 +67,7 @@ with lib;
bookmarks = bookmarks =
helpers.defaultNullOpts.mkListOf helpers.defaultNullOpts.mkListOf
( (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
str str
rawLua rawLua
@ -227,7 +227,7 @@ with lib;
The number of spaces used for left padding. The number of spaces used for left padding.
''; '';
skiplist_server = helpers.defaultNullOpts.mkListOf (with helpers.nixvimTypes; maybeRaw str) [ ] '' skiplist_server = helpers.defaultNullOpts.mkListOf (with lib.types; maybeRaw str) [ ] ''
Do not create the startify buffer, if this is a Vim server instance with a name contained in Do not create the startify buffer, if this is a Vim server instance with a name contained in
this list. this list.

View file

@ -84,7 +84,7 @@ in
oneOf [ oneOf [
# for "text" "mapping" # for "text" "mapping"
(listOf (either str (listOf str))) (listOf (either str (listOf str)))
helpers.nixvimTypes.rawLua rawLua
# for "oldfiles" sections # for "oldfiles" sections
(enum [ "" ]) (enum [ "" ])
] ]

View file

@ -41,7 +41,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
freeformType = with types; attrsOf anything; freeformType = with types; attrsOf anything;
options = { options = {
text = mkOption { text = mkOption {
type = with helpers.nixvimTypes; nullOr (listOf (either str rawLua)); type = with lib.types; nullOr (listOf (either str rawLua));
default = null; default = null;
description = "Segment text."; description = "Segment text.";
example = [ "%C" ]; example = [ "%C" ];
@ -56,7 +56,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
condition = helpers.mkNullOrOption ( condition = helpers.mkNullOrOption (
with helpers.nixvimTypes; listOf (either bool rawLua) with lib.types; listOf (either bool rawLua)
) "Table of booleans or functions returning a boolean."; ) "Table of booleans or functions returning a boolean.";
sign = { sign = {
@ -124,7 +124,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
clickhandlers = mkOption { clickhandlers = mkOption {
type = with helpers.nixvimTypes; attrsOf strLuaFn; type = with lib.types; attrsOf strLuaFn;
default = { }; default = { };
description = '' description = ''
Builtin click handlers. Builtin click handlers.

View file

@ -6,13 +6,13 @@
}: }:
with lib; with lib;
let let
inherit (lib) types;
inherit (lib.nixvim) inherit (lib.nixvim)
defaultNullOpts defaultNullOpts
keymaps keymaps
mkNullOrOption' mkNullOrOption'
transitionType transitionType
; ;
types = lib.nixvim.nixvimTypes;
in in
lib.nixvim.neovim-plugin.mkNeovimPlugin { lib.nixvim.neovim-plugin.mkNeovimPlugin {

View file

@ -156,7 +156,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
opened. opened.
''; '';
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight { highlights = helpers.defaultNullOpts.mkAttrsOf lib.types.highlight {
NormalFloat.link = "Normal"; NormalFloat.link = "Normal";
FloatBorder.link = "Normal"; FloatBorder.link = "Normal";
StatusLine.gui = "NONE"; StatusLine.gui = "NONE";
@ -217,7 +217,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
float_opts = { float_opts = {
border = helpers.mkNullOrOption helpers.nixvimTypes.border '' border = helpers.mkNullOrOption lib.types.border ''
`border` = "single" | "double" | "shadow" | "curved" | ... other options supported by `border` = "single" | "double" | "shadow" | "curved" | ... other options supported by
`win open`. `win open`.
The border key is *almost* the same as 'nvim_open_win'. The border key is *almost* the same as 'nvim_open_win'.

View file

@ -233,8 +233,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
highlight = { highlight = {
additional_vim_regex_highlighting = additional_vim_regex_highlighting =
helpers.defaultNullOpts.mkNullableWithRaw helpers.defaultNullOpts.mkNullableWithRaw (with lib.types; either bool (listOf (maybeRaw str)))
(with helpers.nixvimTypes; either bool (listOf (maybeRaw str)))
false false
'' ''
Setting this to true will run `syntax` and tree-sitter at the same time. \ Setting this to true will run `syntax` and tree-sitter at the same time. \
@ -249,12 +248,10 @@ helpers.neovim-plugin.mkNeovimPlugin {
Whether to enable treesitter highlighting. Whether to enable treesitter highlighting.
''; '';
disable = disable = helpers.defaultNullOpts.mkStrLuaFnOr (with lib.types; listOf (maybeRaw str)) null ''
helpers.defaultNullOpts.mkStrLuaFnOr (with helpers.nixvimTypes; listOf (maybeRaw str)) null Can either be a list of the names of parsers you wish to disable or
'' a lua function that returns a boolean indicating the parser should be disabled.
Can either be a list of the names of parsers you wish to disable or '';
a lua function that returns a boolean indicating the parser should be disabled.
'';
custom_captures = helpers.defaultNullOpts.mkAttrsOf types.str { } '' custom_captures = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
Custom capture group highlighting. Custom capture group highlighting.
@ -290,7 +287,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
ensure_installed = helpers.defaultNullOpts.mkNullable' { ensure_installed = helpers.defaultNullOpts.mkNullable' {
type = type =
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
(enum [ "all" ]) (enum [ "all" ])
(listOf (maybeRaw str)) (listOf (maybeRaw str))
@ -307,7 +304,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
parser_install_dir = helpers.mkNullOrOption' { parser_install_dir = helpers.mkNullOrOption' {
type = with helpers.nixvimTypes; maybeRaw str; type = with lib.types; maybeRaw str;
# Backport the default from nvim-treesitter 1.0 # Backport the default from nvim-treesitter 1.0
# The current default doesn't work on nix, as it is readonly # The current default doesn't work on nix, as it is readonly
default.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'site')"; default.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'site')";

View file

@ -17,7 +17,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
patterns = mkOption { patterns = mkOption {
type = with helpers.nixvimTypes; listOf strLua; type = with lib.types; listOf strLua;
apply = map helpers.mkRaw; apply = map helpers.mkRaw;
default = [ ]; default = [ ];
example = [ "[[%s/\(\n\n\)\n\+/\1/]]" ]; example = [ "[[%s/\(\n\n\)\n\+/\1/]]" ];

View file

@ -21,7 +21,7 @@ in
onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Lua code to run when tsserver attaches to a buffer."; onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Lua code to run when tsserver attaches to a buffer.";
handlers = mkOption { handlers = mkOption {
type = with helpers.nixvimTypes; nullOr (attrsOf strLuaFn); type = with lib.types; nullOr (attrsOf strLuaFn);
apply = v: helpers.ifNonNull' v (mapAttrs (_: helpers.mkRaw) v); apply = v: helpers.ifNonNull' v (mapAttrs (_: helpers.mkRaw) v);
default = null; default = null;
description = "How tsserver should respond to LSP requests"; description = "How tsserver should respond to LSP requests";
@ -72,14 +72,14 @@ in
''; '';
tsserverPlugins = tsserverPlugins =
with helpers.nixvimTypes; with lib.types;
helpers.mkNullOrOption (listOf (maybeRaw str)) '' helpers.mkNullOrOption (listOf (maybeRaw str)) ''
List of plugins for tsserver to load. See this plugins's README List of plugins for tsserver to load. See this plugins's README
at https://github.com/pmizio/typescript-tools.nvim/#-styled-components-support at https://github.com/pmizio/typescript-tools.nvim/#-styled-components-support
''; '';
tsserverMaxMemory = tsserverMaxMemory =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (either ints.unsigned (enum [ "auto" ]))) helpers.mkNullOrOption (with lib.types; maybeRaw (either ints.unsigned (enum [ "auto" ])))
'' ''
This value is passed to: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes This value is passed to: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
Memory limit in megabytes or "auto"(basically no limit) Memory limit in megabytes or "auto"(basically no limit)

View file

@ -56,7 +56,7 @@ mkVimPlugin {
Whether to preserve cursor position when sending a line or paragraph. Whether to preserve cursor position when sending a line or paragraph.
''; '';
default_config = helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf (either str rawLua)) '' default_config = helpers.mkNullOrOption (with lib.types; attrsOf (either str rawLua)) ''
Pre-filled prompt answer. Pre-filled prompt answer.
Examples: Examples:

View file

@ -5,8 +5,8 @@
}: }:
with lib; with lib;
let let
inherit (lib) types;
inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject; inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject;
types = lib.nixvim.nixvimTypes;
opt = options.plugins.which-key; opt = options.plugins.which-key;

View file

@ -156,7 +156,7 @@ in
Setting the option after the first run has no effect. Setting the option after the first run has no effect.
''; '';
pipeline = helpers.mkNullOrOption (with helpers.nixvimTypes; listOf strLua) '' pipeline = helpers.mkNullOrOption (with lib.types; listOf strLua) ''
Sets the pipeline to use to get completions. Sets the pipeline to use to get completions.
See `|wilder-pipeline|`. See `|wilder-pipeline|`.

View file

@ -216,7 +216,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
''; '';
mappings = helpers.defaultNullOpts.mkAttrsOf' { mappings = helpers.defaultNullOpts.mkAttrsOf' {
type = with helpers.nixvimTypes; either strLuaFn (attrsOf strLuaFn); type = with lib.types; either strLuaFn (attrsOf strLuaFn);
apply = apply =
mappings: mappings:
helpers.ifNonNull' mappings ( helpers.ifNonNull' mappings (

View file

@ -3,8 +3,8 @@
... ...
}: }:
let let
inherit (lib) types;
inherit (lib.nixvim) defaultNullOpts; inherit (lib.nixvim) defaultNullOpts;
types = lib.nixvim.nixvimTypes;
in in
lib.nixvim.neovim-plugin.mkNeovimPlugin { lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "yazi"; name = "yazi";

View file

@ -22,7 +22,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
width = width =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
( (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
ints.positive ints.positive
(numbers.between 0.0 1.0) (numbers.between 0.0 1.0)
@ -42,7 +42,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
height = height =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
( (
with helpers.nixvimTypes; with lib.types;
oneOf [ oneOf [
ints.positive ints.positive
(numbers.between 0.0 1.0) (numbers.between 0.0 1.0)

View file

@ -61,7 +61,7 @@ in
{ {
warnings = warnings =
# TODO: expand this warning to ft & cmd sources lists and `showDefs` the offending definitions # TODO: expand this warning to ft & cmd sources lists and `showDefs` the offending definitions
optional (helpers.nixvimTypes.isRawType cfg.settings.sources) '' optional (lib.types.isRawType cfg.settings.sources) ''
Nixvim (plugins.cmp): You have enabled `autoEnableSources` that tells Nixvim to automatically Nixvim (plugins.cmp): You have enabled `autoEnableSources` that tells Nixvim to automatically
enable the source plugins with respect to the list of sources provided in `settings.sources`. enable the source plugins with respect to the list of sources provided in `settings.sources`.
However, the latter is proveded as a raw lua string which is not parseable by Nixvim. However, the latter is proveded as a raw lua string which is not parseable by Nixvim.

View file

@ -38,7 +38,7 @@ with lib;
mapping = mkOption { mapping = mkOption {
default = { }; default = { };
type = with helpers.nixvimTypes; maybeRaw (attrsOf strLua); type = with lib.types; maybeRaw (attrsOf strLua);
description = '' description = ''
cmp mappings declaration. cmp mappings declaration.
See `:h cmp-mapping` for more information. See `:h cmp-mapping` for more information.
@ -46,7 +46,7 @@ with lib;
apply = apply =
v: v:
# Handle the raw case first # Handle the raw case first
if helpers.nixvimTypes.isRawType v then if lib.types.isRawType v then
v v
# When v is an attrs **but not {__raw = ...}** # When v is an attrs **but not {__raw = ...}**
else else
@ -64,7 +64,7 @@ with lib;
snippet = { snippet = {
expand = mkOption { expand = mkOption {
type = with helpers.nixvimTypes; nullOr strLuaFn; type = with lib.types; nullOr strLuaFn;
default = null; default = null;
description = '' description = ''
The snippet expansion function. That's how nvim-cmp interacts with a particular snippet The snippet expansion function. That's how nvim-cmp interacts with a particular snippet
@ -115,8 +115,7 @@ with lib;
keyword_pattern = helpers.defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern."; keyword_pattern = helpers.defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern.";
autocomplete = autocomplete =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable (with lib.types; either (enum [ false ]) (listOf strLua))
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
[ "require('cmp.types').cmp.TriggerEvent.TextChanged" ] [ "require('cmp.types').cmp.TriggerEvent.TextChanged" ]
'' ''
The event to trigger autocompletion. The event to trigger autocompletion.
@ -210,7 +209,7 @@ with lib;
''; '';
comparators = mkOption { comparators = mkOption {
type = with helpers.nixvimTypes; nullOr (listOf strLuaFn); type = with lib.types; nullOr (listOf strLuaFn);
apply = v: helpers.ifNonNull' v (map helpers.mkRaw v); apply = v: helpers.ifNonNull' v (map helpers.mkRaw v);
default = null; default = null;
description = '' description = ''

View file

@ -81,7 +81,7 @@ let
in in
mkOption { mkOption {
default = [ ]; default = [ ];
type = with helpers.nixvimTypes; maybeRaw (listOf sourceType); type = with lib.types; maybeRaw (listOf sourceType);
description = '' description = ''
The sources to use. The sources to use.
Can either be a list of `sourceConfigs` which will be made directly to a Lua object. Can either be a list of `sourceConfigs` which will be made directly to a Lua object.

View file

@ -161,7 +161,7 @@ in
}; };
action = mkOption { action = mkOption {
type = helpers.nixvimTypes.strLuaFn; type = lib.types.strLuaFn;
apply = helpers.mkRaw; apply = helpers.mkRaw;
description = '' description = ''
The parameters to the action function are the different sources (currently `git`, The parameters to the action function are the different sources (currently `git`,

View file

@ -74,7 +74,7 @@ in
kind: kind:
{ lang, possible }: { lang, possible }:
let let
toolType = helpers.nixvimTypes.maybeRaw (lib.types.enum possible); toolType = lib.types.maybeRaw (lib.types.enum possible);
in in
lib.mkOption { lib.mkOption {
type = lib.types.either toolType (lib.types.listOf toolType); type = lib.types.either toolType (lib.types.listOf toolType);

View file

@ -2,8 +2,7 @@
with lib; with lib;
{ {
enabled = enabled =
helpers.defaultNullOpts.mkNullableWithRaw helpers.defaultNullOpts.mkNullableWithRaw (with lib.types; either bool (listOf (maybeRaw str)))
(with helpers.nixvimTypes; either bool (listOf (maybeRaw str)))
[ [
"bibtex" "bibtex"
"context" "context"
@ -102,125 +101,119 @@ with lib;
- "zh-CN": Chinese - "zh-CN": Chinese
''; '';
dictionary = dictionary = helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { } ''
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; listOf (maybeRaw str)) { } Lists of additional words that should not be counted as spelling errors.
'' This setting is language-specific, so use an attrs of the format
Lists of additional words that should not be counted as spelling errors. ```nix
This setting is language-specific, so use an attrs of the format {
```nix "<LANGUAGE1>" = [
{ "<WORD1>"
"<LANGUAGE1>" = [ "<WORD2>"
"<WORD1>" ...
"<WORD2>" ];
... "<LANGUAGE2>" = [
]; "<WORD1>"
"<LANGUAGE2>" = [ "<WORD2>"
"<WORD1>" ];
"<WORD2>" ...
]; };
... ```
}; where <LANGUAGE> denotes the language code in `settings.language`.
```
where <LANGUAGE> denotes the language code in `settings.language`.
This setting is a multi-scope setting. See the documentation for details. This setting is a multi-scope setting. See the documentation for details.
This setting supports external files. See the documentation for details. This setting supports external files. See the documentation for details.
By default, no additional spelling errors will be ignored. By default, no additional spelling errors will be ignored.
Example: Example:
```nix ```nix
{ {
"en-US" = [ "en-US" = [
"adaptivity" "adaptivity"
"precomputed" "precomputed"
"subproblem" "subproblem"
]; ];
"de-DE" = [ "de-DE" = [
"B-Splines" "B-Splines"
":/path/to/externalFile.txt" ":/path/to/externalFile.txt"
]; ];
} }
``` ```
''; '';
disabledRules = disabledRules = helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { } ''
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; listOf (maybeRaw str)) { } Lists of rules that should be disabled (if enabled by default by LanguageTool).
'' This setting is language-specific, so use an attrs of the format
Lists of rules that should be disabled (if enabled by default by LanguageTool). ```nix
This setting is language-specific, so use an attrs of the format {
```nix "<LANGUAGE1>" = [
{ "<WORD1>"
"<LANGUAGE1>" = [ "<WORD2>"
"<WORD1>" ...
"<WORD2>" ];
... "<LANGUAGE2>" = [
]; "<WORD1>"
"<LANGUAGE2>" = [ "<WORD2>"
"<WORD1>" ];
"<WORD2>" ...
]; };
... ```
}; where `<LANGUAGE>` denotes the language code in `settings.language` and `<RULE>` the ID of
``` the LanguageTool rule.
where `<LANGUAGE>` denotes the language code in `settings.language` and `<RULE>` the ID of
the LanguageTool rule.
This setting is a multi-scope setting. See the documentation for details. This setting is a multi-scope setting. See the documentation for details.
This setting supports external files. See the documentation for details. This setting supports external files. See the documentation for details.
By default, no additional rules will be disabled. By default, no additional rules will be disabled.
Example: Example:
```nix ```nix
{ {
"en-US" = [ "en-US" = [
"EN_QUOTES" "EN_QUOTES"
"UPPERCASE_SENTENCE_START" "UPPERCASE_SENTENCE_START"
":/path/to/externalFile.txt" ":/path/to/externalFile.txt"
]; ];
} }
``` ```
''; '';
enabledRules = enabledRules = helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { } ''
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; listOf (maybeRaw str)) { } Lists of rules that should be enabled (if disabled by default by LanguageTool).
'' This setting is language-specific, so use an attrs of the format
Lists of rules that should be enabled (if disabled by default by LanguageTool). ```nix
This setting is language-specific, so use an attrs of the format {
```nix "<LANGUAGE1>" = [
{ "<WORD1>"
"<LANGUAGE1>" = [ "<WORD2>"
"<WORD1>" ...
"<WORD2>" ];
... "<LANGUAGE2>" = [
]; "<WORD1>"
"<LANGUAGE2>" = [ "<WORD2>"
"<WORD1>" ];
"<WORD2>" ...
]; };
... ```
}; where `<LANGUAGE>` denotes the language code in `settings.language` and `<RULE>` the ID of
``` the LanguageTool rule.
where `<LANGUAGE>` denotes the language code in `settings.language` and `<RULE>` the ID of
the LanguageTool rule.
This setting is a multi-scope setting. See the documentation for details. This setting is a multi-scope setting. See the documentation for details.
This setting supports external files. See the documentation for details. This setting supports external files. See the documentation for details.
By default, no additional rules will be enabled. By default, no additional rules will be enabled.
Example: Example:
```nix ```nix
{ {
"en-GB" = [ "en-GB" = [
"PASSIVE_VOICE" "PASSIVE_VOICE"
"OXFORD_SPELLING_NOUNS" "OXFORD_SPELLING_NOUNS"
":/path/to/externalFile.txt" ":/path/to/externalFile.txt"
]; ];
} }
``` ```
''; '';
hiddenFalsePositives = hiddenFalsePositives =
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; listOf (maybeRaw str)) { } helpers.defaultNullOpts.mkAttrsOf (with lib.types; listOf (maybeRaw str)) { }
'' ''
Lists of false-positive diagnostics to hide (by hiding all diagnostics of a specific rule Lists of false-positive diagnostics to hide (by hiding all diagnostics of a specific rule
within a specific sentence). within a specific sentence).
@ -571,8 +564,7 @@ with lib;
''; '';
diagnosticSeverity = diagnosticSeverity =
helpers.defaultNullOpts.mkNullableWithRaw helpers.defaultNullOpts.mkNullableWithRaw (with lib.types; either str (attrsOf (maybeRaw str)))
(with helpers.nixvimTypes; either str (attrsOf (maybeRaw str)))
"information" "information"
'' ''
Severity of the diagnostics corresponding to the grammar and spelling errors. Severity of the diagnostics corresponding to the grammar and spelling errors.

View file

@ -38,7 +38,7 @@ with lib;
}; };
}; };
in in
helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf (maybeRaw provider)) '' helpers.mkNullOrOption (with lib.types; attrsOf (maybeRaw provider)) ''
Tell the language server your desired option set, for completion. Tell the language server your desired option set, for completion.
This is lazily evaluated. This is lazily evaluated.
''; '';
@ -54,7 +54,7 @@ with lib;
}; };
}; };
in in
helpers.mkNullOrOption (helpers.nixvimTypes.maybeRaw provider) '' helpers.mkNullOrOption (lib.types.maybeRaw provider) ''
This expression will be interpreted as "nixpkgs" toplevel This expression will be interpreted as "nixpkgs" toplevel
Nixd provides package, lib completion/information from it. Nixd provides package, lib completion/information from it.
''; '';

View file

@ -85,7 +85,7 @@ in
or firenvim for example. (accepts fun(LazyPlugin):boolean) or firenvim for example. (accepts fun(LazyPlugin):boolean)
''; '';
dependencies = helpers.mkNullOrOption (helpers.nixvimTypes.eitherRecursive str listOfPlugins) "Plugin dependencies"; dependencies = helpers.mkNullOrOption (eitherRecursive str listOfPlugins) "Plugin dependencies";
init = helpers.mkNullOrLuaFn "init functions are always executed during startup"; init = helpers.mkNullOrLuaFn "init functions are always executed during startup";
@ -107,19 +107,19 @@ in
''; '';
event = event =
with helpers.nixvimTypes; with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on event. Events can be specified as BufEnter or with a pattern like BufEnter *.lua"; helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on event. Events can be specified as BufEnter or with a pattern like BufEnter *.lua";
cmd = cmd =
with helpers.nixvimTypes; with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on command"; helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on command";
ft = ft =
with helpers.nixvimTypes; with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on filetype"; helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on filetype";
keys = keys =
with helpers.nixvimTypes; with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on key mapping"; helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on key mapping";
module = helpers.mkNullOrOption (enum [ false ]) '' module = helpers.mkNullOrOption (enum [ false ]) ''
@ -139,7 +139,7 @@ in
''; '';
opts = opts =
with helpers.nixvimTypes; with lib.types;
helpers.mkNullOrOption (maybeRaw (attrsOf anything)) '' helpers.mkNullOrOption (maybeRaw (attrsOf anything)) ''
opts should be a table (will be merged with parent specs), opts should be a table (will be merged with parent specs),
return a table (replaces parent specs) or should change a table. return a table (replaces parent specs) or should change a table.

View file

@ -131,7 +131,7 @@ nixvim.neovim-plugin.mkNeovimPlugin {
plugins = mkOption { plugins = mkOption {
description = '' description = ''
List of plugin specs provided to the `require('lz.n').load` function. List of plugin specs provided to the `require('lz.n').load` function.
Plugin specs can be ${nixvim.nixvimTypes.rawLua.description}. Plugin specs can be ${types.rawLua.description}.
''; '';
default = [ ]; default = [ ];
type = types.listOf lzPluginType; type = types.listOf lzPluginType;

View file

@ -57,17 +57,17 @@ in
run = helpers.mkNullOrOption (oneOf [ run = helpers.mkNullOrOption (oneOf [
str str
helpers.nixvimTypes.rawLua rawLua
(listOf (either str helpers.nixvimTypes.rawLua)) (listOf (either str rawLua))
]) "Post-install hook"; ]) "Post-install hook";
requires = helpers.mkNullOrOption (helpers.nixvimTypes.eitherRecursive str listOfPlugins) "Plugin dependencies"; requires = helpers.mkNullOrOption (eitherRecursive str listOfPlugins) "Plugin dependencies";
rocks = helpers.mkNullOrOption (either str (listOf (either str attrs))) "Luarocks dependencies"; rocks = helpers.mkNullOrOption (either str (listOf (either str attrs))) "Luarocks dependencies";
config = helpers.mkNullOrOption (either str helpers.nixvimTypes.rawLua) "Code to run after this plugin is loaded"; config = helpers.mkNullOrOption (either str rawLua) "Code to run after this plugin is loaded";
setup = helpers.mkNullOrOption (either str helpers.nixvimTypes.rawLua) "Code to be run before this plugin is loaded"; setup = helpers.mkNullOrOption (either str rawLua) "Code to be run before this plugin is loaded";
cmd = helpers.mkNullOrOption (either str (listOf str)) "Commands which load this plugin"; cmd = helpers.mkNullOrOption (either str (listOf str)) "Commands which load this plugin";
@ -81,8 +81,8 @@ in
cond = helpers.mkNullOrOption (oneOf [ cond = helpers.mkNullOrOption (oneOf [
str str
helpers.nixvimTypes.rawLua rawLua
(listOf (either str helpers.nixvimTypes.rawLua)) (listOf (either str rawLua))
]) "Conditional test to load this plugin"; ]) "Conditional test to load this plugin";
module = helpers.mkNullOrOption (either str (listOf str)) "Patterns of module names which load this plugin"; module = helpers.mkNullOrOption (either str (listOf str)) "Patterns of module names which load this plugin";

View file

@ -90,7 +90,7 @@
# tool options are a `either toolType (listOf toolType)` # tool options are a `either toolType (listOf toolType)`
# Look into `nestedTypes.left` to get a `toolType` option. # Look into `nestedTypes.left` to get a `toolType` option.
toolType = opt.type.nestedTypes.left; toolType = opt.type.nestedTypes.left;
# toolType is a `either (enum possible) helpers.nixvimTypes.rawLua # toolType is a `either (enum possible) rawLua
# Look into `nestedTypes.left` for the enum # Look into `nestedTypes.left` for the enum
possible = toolType.nestedTypes.left; possible = toolType.nestedTypes.left;
# possible is an enum, look into functor.payload for the variants # possible is an enum, look into functor.payload for the variants