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

@ -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)