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
;
# 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;
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 {
luaConfig = lib.mkOption {
type = lib.nixvim.nixvimTypes.pluginLuaConfig;
type = lib.types.pluginLuaConfig;
default = { };
description = "The plugin's lua configuration";
};

View file

@ -8,7 +8,7 @@ let
commandAttributes = lib.types.submodule {
options = {
command = lib.mkOption {
type = with helpers.nixvimTypes; either str rawLua;
type = with lib.types; either str rawLua;
description = "The command to run.";
};
@ -24,7 +24,7 @@ let
''
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.
'';
range =

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -42,13 +42,13 @@ in
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 default value is dynamic and depends on `pytest.ini` or `manage.py` markers.
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.
Built-in are test runners for unittest, pytest and django.
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 = {
keymaps =
helpers.defaultNullOpts.mkAttrsOf (with helpers.nixvimTypes; attrsOf (either str rawLua))
helpers.defaultNullOpts.mkAttrsOf (with lib.types; attrsOf (either str rawLua))
{
normal = {
plain_below = "g?p";

View file

@ -136,7 +136,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
in
helpers.mkNullOrOption' {
type =
with helpers.nixvimTypes;
with lib.types;
either strLua (submodule {
freeformType = attrsOf anything;
options = {
@ -181,7 +181,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
# This option accepts an attrs or a lua string.
# Hence, we convert the string to raw lua in `apply`.
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;
description = ''
Buffer-local keymaps to be added to edgebar buffers.

View file

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

View file

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

View file

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

View file

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

View file

@ -58,14 +58,14 @@ with lib;
freeformType = with types; attrsOf anything;
options = {
toplevel = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
type = with lib.types; maybeRaw str;
description = ''
Path to the top-level of the parent git repository.
'';
};
gitdir = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
type = with lib.types; maybeRaw str;
description = ''
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 (
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.";
body = helpers.mkNullOrStr ''
@ -75,12 +75,12 @@ let
'';
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.";
};
};
headType =
with helpers.nixvimTypes;
with lib.types;
# More precisely, a tuple: [head action opts]
listOf (
nullOr (

View file

@ -129,7 +129,7 @@ with lib;
'';
funcs = mkOption {
type = with helpers.nixvimTypes; attrsOf strLuaFn;
type = with lib.types; attrsOf strLuaFn;
description = ''
Table from function names to function.
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.
'';
type =
with helpers.nixvimTypes;
with lib.types;
listOf (submodule {
options = {
key = mkOption {
@ -34,7 +34,7 @@ helpers.vim-plugin.mkVimPlugin {
action = mkOption {
type =
with helpers.nixvimTypes;
with lib.types;
maybeRaw (
# https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators
enum [

View file

@ -90,7 +90,7 @@ in
};
safeLabels =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; maybeRaw (listOf str))
helpers.defaultNullOpts.mkNullable (with lib.types; maybeRaw (listOf str))
(stringToCharacters "sfnut/SFNLHMUGT?Z")
''
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 = {
type = listOf (either str helpers.nixvimTypes.rawLua);
type = listOf (either str rawLua);
description = ''
List of arguments.
Can contain functions with zero arguments that will be evaluated once the linter is used.
@ -86,7 +86,7 @@ let
};
parser = {
type = helpers.nixvimTypes.strLuaFn;
type = lib.types.strLuaFn;
description = "The code for your parser function.";
example = ''
require('lint.parser').from_pattern(pattern, groups, severity_map, defaults, opts)
@ -211,7 +211,7 @@ in
};
callback = mkOption {
type = with types; nullOr (either str helpers.nixvimTypes.rawLua);
type = with types; nullOr (either str rawLua);
default = defaultCallback;
description = "What action to perform for linting";
};

View file

@ -23,7 +23,7 @@ let
paths =
helpers.mkNullOrOption
(
with helpers.nixvimTypes;
with lib.types;
oneOf [
str
path
@ -39,11 +39,11 @@ let
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.
'';
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.
'';
};

View file

@ -75,7 +75,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
'';
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`).
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.";
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.
'';
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.
'';

View file

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

View file

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

View file

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

View file

@ -31,7 +31,7 @@ with lib;
'';
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.";
};
@ -224,7 +224,7 @@ with lib;
attrsOf (submodule {
options = {
action = mkOption {
type = helpers.nixvimTypes.strLua;
type = lib.types.strLua;
description = "The lua code for this keymap action.";
apply = helpers.mkRaw;
};
@ -372,12 +372,12 @@ with lib;
submodule {
options = {
char = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
type = with lib.types; maybeRaw str;
description = "The character to use for this checkbox.";
};
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.";
};
};
@ -447,7 +447,7 @@ with lib;
'';
};
hl_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight {
hl_groups = helpers.defaultNullOpts.mkAttrsOf lib.types.highlight {
ObsidianTodo = {
bold = true;
fg = "#f78c6c";

View file

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

View file

@ -10,7 +10,7 @@ let
cfg = config.plugins.ollama;
actionOptionType =
with helpers.nixvimTypes;
with lib.types;
oneOf [
rawLua
(enum [
@ -78,7 +78,7 @@ in
let
promptOptions = {
prompt = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
type = with lib.types; maybeRaw str;
description = ''
The prompt to send to the model.
@ -112,8 +112,7 @@ in
'';
extract =
helpers.defaultNullOpts.mkNullable
(with helpers.nixvimTypes; maybeRaw (either str (enum [ false ])))
helpers.defaultNullOpts.mkNullable (with lib.types; maybeRaw (either str (enum [ false ])))
"```$ftype\n(.-)```"
''
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.
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.
@ -128,7 +128,7 @@ in
'';
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.
@ -137,8 +137,7 @@ in
'';
gitCommitText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
"Committing changes"
helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Committing changes"
''
String rendered when committing changes in git.
@ -147,8 +146,7 @@ in
'';
pluginManagerText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
"Managing plugins"
helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Managing plugins"
''
String rendered when managing plugins.
@ -157,7 +155,7 @@ in
'';
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.
@ -166,8 +164,7 @@ in
'';
workspaceText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
"Working on %s"
helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Working on %s"
''
String rendered when in a git repository.
@ -176,8 +173,7 @@ in
'';
lineNumberText =
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
"Line %s out of %s"
helpers.defaultNullOpts.mkNullable (types.either types.str types.rawLua) "Line %s out of %s"
''
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" ];
};
settingsOptions = with helpers.nixvimTypes; {
settingsOptions = with lib.types; {
prompt_func_return_type =
helpers.defaultNullOpts.mkAttrsOf bool
{

View file

@ -327,7 +327,7 @@ with lib;
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.
'';
};

View file

@ -18,20 +18,20 @@ helpers.vim-plugin.mkVimPlugin {
freeformType = with types; attrsOf anything;
options = {
name = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
type = with lib.types; maybeRaw str;
description = "The name of the schema.";
};
description = helpers.mkNullOrStr "A description for this schema.";
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.
'';
url = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
type = with lib.types; maybeRaw str;
description = "The URL of this schema.";
};
};

View file

@ -7,7 +7,7 @@ with lib;
lists = mkOption {
type =
with helpers.nixvimTypes;
with lib.types;
listOf (
either strLua (submodule {
freeformType = with types; attrsOf anything;
@ -18,12 +18,12 @@ with lib;
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
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.
Opposed to the global `custom_indices`, this is limited to the current list.
'';
@ -67,7 +67,7 @@ with lib;
bookmarks =
helpers.defaultNullOpts.mkListOf
(
with helpers.nixvimTypes;
with lib.types;
oneOf [
str
rawLua
@ -227,7 +227,7 @@ with lib;
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
this list.

View file

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

View file

@ -41,7 +41,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
freeformType = with types; attrsOf anything;
options = {
text = mkOption {
type = with helpers.nixvimTypes; nullOr (listOf (either str rawLua));
type = with lib.types; nullOr (listOf (either str rawLua));
default = null;
description = "Segment text.";
example = [ "%C" ];
@ -56,7 +56,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
'';
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.";
sign = {
@ -124,7 +124,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
'';
clickhandlers = mkOption {
type = with helpers.nixvimTypes; attrsOf strLuaFn;
type = with lib.types; attrsOf strLuaFn;
default = { };
description = ''
Builtin click handlers.

View file

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

View file

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

View file

@ -233,8 +233,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
highlight = {
additional_vim_regex_highlighting =
helpers.defaultNullOpts.mkNullableWithRaw
(with helpers.nixvimTypes; either bool (listOf (maybeRaw str)))
helpers.defaultNullOpts.mkNullableWithRaw (with lib.types; either bool (listOf (maybeRaw str)))
false
''
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.
'';
disable =
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.
'';
disable = helpers.defaultNullOpts.mkStrLuaFnOr (with lib.types; 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.
'';
custom_captures = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
Custom capture group highlighting.
@ -290,7 +287,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
ensure_installed = helpers.defaultNullOpts.mkNullable' {
type =
with helpers.nixvimTypes;
with lib.types;
oneOf [
(enum [ "all" ])
(listOf (maybeRaw str))
@ -307,7 +304,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
'';
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
# The current default doesn't work on nix, as it is readonly
default.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'site')";

View file

@ -17,7 +17,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
'';
patterns = mkOption {
type = with helpers.nixvimTypes; listOf strLua;
type = with lib.types; listOf strLua;
apply = map helpers.mkRaw;
default = [ ];
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.";
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);
default = null;
description = "How tsserver should respond to LSP requests";
@ -72,14 +72,14 @@ in
'';
tsserverPlugins =
with helpers.nixvimTypes;
with lib.types;
helpers.mkNullOrOption (listOf (maybeRaw str)) ''
List of plugins for tsserver to load. See this plugins's README
at https://github.com/pmizio/typescript-tools.nvim/#-styled-components-support
'';
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
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.
'';
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.
Examples:

View file

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

View file

@ -156,7 +156,7 @@ in
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.
See `|wilder-pipeline|`.

View file

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

View file

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

View file

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

View file

@ -61,7 +61,7 @@ in
{
warnings =
# 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
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.

View file

@ -38,7 +38,7 @@ with lib;
mapping = mkOption {
default = { };
type = with helpers.nixvimTypes; maybeRaw (attrsOf strLua);
type = with lib.types; maybeRaw (attrsOf strLua);
description = ''
cmp mappings declaration.
See `:h cmp-mapping` for more information.
@ -46,7 +46,7 @@ with lib;
apply =
v:
# Handle the raw case first
if helpers.nixvimTypes.isRawType v then
if lib.types.isRawType v then
v
# When v is an attrs **but not {__raw = ...}**
else
@ -64,7 +64,7 @@ with lib;
snippet = {
expand = mkOption {
type = with helpers.nixvimTypes; nullOr strLuaFn;
type = with lib.types; nullOr strLuaFn;
default = null;
description = ''
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.";
autocomplete =
helpers.defaultNullOpts.mkNullable
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
helpers.defaultNullOpts.mkNullable (with lib.types; either (enum [ false ]) (listOf strLua))
[ "require('cmp.types').cmp.TriggerEvent.TextChanged" ]
''
The event to trigger autocompletion.
@ -210,7 +209,7 @@ with lib;
'';
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);
default = null;
description = ''

View file

@ -81,7 +81,7 @@ let
in
mkOption {
default = [ ];
type = with helpers.nixvimTypes; maybeRaw (listOf sourceType);
type = with lib.types; maybeRaw (listOf sourceType);
description = ''
The sources to use.
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 {
type = helpers.nixvimTypes.strLuaFn;
type = lib.types.strLuaFn;
apply = helpers.mkRaw;
description = ''
The parameters to the action function are the different sources (currently `git`,

View file

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

View file

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

View file

@ -38,7 +38,7 @@ with lib;
};
};
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.
This is lazily evaluated.
'';
@ -54,7 +54,7 @@ with lib;
};
};
in
helpers.mkNullOrOption (helpers.nixvimTypes.maybeRaw provider) ''
helpers.mkNullOrOption (lib.types.maybeRaw provider) ''
This expression will be interpreted as "nixpkgs" toplevel
Nixd provides package, lib completion/information from it.
'';

View file

@ -85,7 +85,7 @@ in
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";
@ -107,19 +107,19 @@ in
'';
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";
cmd =
with helpers.nixvimTypes;
with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on command";
ft =
with helpers.nixvimTypes;
with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on filetype";
keys =
with helpers.nixvimTypes;
with lib.types;
helpers.mkNullOrOption (maybeRaw (either str (listOf str))) "Lazy-load on key mapping";
module = helpers.mkNullOrOption (enum [ false ]) ''
@ -139,7 +139,7 @@ in
'';
opts =
with helpers.nixvimTypes;
with lib.types;
helpers.mkNullOrOption (maybeRaw (attrsOf anything)) ''
opts should be a table (will be merged with parent specs),
return a table (replaces parent specs) or should change a table.

View file

@ -131,7 +131,7 @@ nixvim.neovim-plugin.mkNeovimPlugin {
plugins = mkOption {
description = ''
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 = [ ];
type = types.listOf lzPluginType;

View file

@ -57,17 +57,17 @@ in
run = helpers.mkNullOrOption (oneOf [
str
helpers.nixvimTypes.rawLua
(listOf (either str helpers.nixvimTypes.rawLua))
rawLua
(listOf (either str rawLua))
]) "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";
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";
@ -81,8 +81,8 @@ in
cond = helpers.mkNullOrOption (oneOf [
str
helpers.nixvimTypes.rawLua
(listOf (either str helpers.nixvimTypes.rawLua))
rawLua
(listOf (either str rawLua))
]) "Conditional test to 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)`
# Look into `nestedTypes.left` to get a `toolType` option.
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
possible = toolType.nestedTypes.left;
# possible is an enum, look into functor.payload for the variants