mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-30 04:14:28 +02:00
helpers: Add option helpers for types that are either a lua str or a value (#876)
Those types needed the following code in apply: if builtins.isString value then mkRaw value else value This commit avoids this boilerplate, and clarifies that the `str` is lua code in the documentation.
This commit is contained in:
parent
8b8a1c0f4b
commit
8aa4b7e4ce
13 changed files with 109 additions and 129 deletions
|
@ -20,11 +20,7 @@ in {
|
|||
'';
|
||||
|
||||
timeout =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either ints.unsigned str
|
||||
)
|
||||
helpers.defaultNullOpts.mkStrLuaOr types.ints.unsigned
|
||||
"vim.o.timeoutlen"
|
||||
''
|
||||
The time in which the keys must be hit in ms.
|
||||
|
@ -58,11 +54,7 @@ in {
|
|||
config = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
inherit mapping;
|
||||
timeout =
|
||||
if isString timeout
|
||||
then helpers.mkRaw timeout
|
||||
else timeout;
|
||||
inherit mapping timeout;
|
||||
clear_empty_lines = clearEmptyLines;
|
||||
inherit keys;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue