mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +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
|
||||
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;`
|
||||
// lib.types
|
||||
|
|
|
@ -10,15 +10,6 @@ let
|
|||
inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject;
|
||||
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;
|
||||
in
|
||||
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`.
|
||||
'';
|
||||
|
||||
padding = defaultNullOpts.mkNullable (listOfLen types.int 2) [
|
||||
padding = defaultNullOpts.mkNullable (types.listOfLen types.int 2) [
|
||||
1
|
||||
2
|
||||
] "Extra window padding, in the form `[top/bottom, right/left]`.";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue