mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 16:39:00 +02:00
plugins/which-key: move listOfLen to lib.types
Allows us to require a list to have a certain length for plugins that request it.
This commit is contained in:
parent
4eb2ad7db7
commit
e3ec1c4a46
2 changed files with 10 additions and 10 deletions
|
@ -81,6 +81,15 @@ rec {
|
||||||
|
|
||||||
# Overridden when building the documentation
|
# Overridden when building the documentation
|
||||||
eitherRecursive = either;
|
eitherRecursive = either;
|
||||||
|
|
||||||
|
listOfLen =
|
||||||
|
elemType: len:
|
||||||
|
addCheck (listOf elemType) (v: builtins.length v == len)
|
||||||
|
// {
|
||||||
|
description = "list of ${toString len} ${
|
||||||
|
optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType
|
||||||
|
}";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
# Allow to do `with nixvimTypes;` instead of `with types;`
|
# Allow to do `with nixvimTypes;` instead of `with types;`
|
||||||
// lib.types
|
// lib.types
|
||||||
|
|
|
@ -10,15 +10,6 @@ let
|
||||||
inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject;
|
inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject;
|
||||||
types = lib.nixvim.nixvimTypes;
|
types = lib.nixvim.nixvimTypes;
|
||||||
|
|
||||||
listOfLen =
|
|
||||||
elemType: len:
|
|
||||||
types.addCheck (types.listOf elemType) (v: length v == len)
|
|
||||||
// {
|
|
||||||
description = "list of ${toString len} ${
|
|
||||||
types.optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType
|
|
||||||
}";
|
|
||||||
};
|
|
||||||
|
|
||||||
opt = options.plugins.which-key;
|
opt = options.plugins.which-key;
|
||||||
in
|
in
|
||||||
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
||||||
|
@ -332,7 +323,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
||||||
Supports all available border types from `vim.api.keyset.win_config.border`.
|
Supports all available border types from `vim.api.keyset.win_config.border`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
padding = defaultNullOpts.mkNullable (listOfLen types.int 2) [
|
padding = defaultNullOpts.mkNullable (types.listOfLen types.int 2) [
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
] "Extra window padding, in the form `[top/bottom, right/left]`.";
|
] "Extra window padding, in the form `[top/bottom, right/left]`.";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue