lib/types: add extCommasEnum...
that convert enum or list of enum to commas
This commit is contained in:
parent
49b7045c56
commit
4f8b523579
2 changed files with 34 additions and 30 deletions
|
@ -1,12 +1,16 @@
|
||||||
{ lib, nix2lua }:
|
{ lib, nix2lua }:
|
||||||
|
|
||||||
let
|
let
|
||||||
extCommas = with lib.types;
|
extendCommasTypeWith = t:
|
||||||
|
with lib.types;
|
||||||
coercedTo
|
coercedTo
|
||||||
(either (listOf str) commas)
|
(either (listOf t) t)
|
||||||
(x: lib.concatStringsSep "," (lib.toList x))
|
(x: lib.concatStringsSep "," (lib.toList x))
|
||||||
commas;
|
commas;
|
||||||
|
|
||||||
|
extCommas = extendCommasTypeWith lib.types.str;
|
||||||
|
extCommasEnum = variants: extendCommasTypeWith (lib.types.enum variants);
|
||||||
|
|
||||||
modeEnum = lib.types.enum [ "" "n" "!" "i" "c" "v" "x" "s" "o" "t" "l" ];
|
modeEnum = lib.types.enum [ "" "n" "!" "i" "c" "v" "x" "s" "o" "t" "l" ];
|
||||||
mode = with lib.types; either modeEnum (uniq (listOf modeEnum));
|
mode = with lib.types; either modeEnum (uniq (listOf modeEnum));
|
||||||
|
|
||||||
|
@ -151,6 +155,6 @@ let
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit extCommas;
|
inherit extCommas extCommasEnum;
|
||||||
inherit mode keymap;
|
inherit mode keymap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ let
|
||||||
|
|
||||||
sharedGlobalOrWindow = with lib.types; {
|
sharedGlobalOrWindow = with lib.types; {
|
||||||
fillchars = {
|
fillchars = {
|
||||||
type = listOf (enum [
|
type = extCommasEnum [
|
||||||
"stl"
|
"stl"
|
||||||
"stlnc"
|
"stlnc"
|
||||||
"wbr"
|
"wbr"
|
||||||
|
@ -43,7 +43,7 @@ let
|
||||||
"msgsep"
|
"msgsep"
|
||||||
"eob"
|
"eob"
|
||||||
"lastline"
|
"lastline"
|
||||||
]);
|
];
|
||||||
vimDefault = [ ];
|
vimDefault = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Characters to fill the statuslines, vertical separators and special lines in the window.
|
Characters to fill the statuslines, vertical separators and special lines in the window.
|
||||||
|
@ -100,7 +100,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualedit = {
|
virtualedit = {
|
||||||
type = listOf (enum [ "block" "insert" "all" "onemore" "none" "NONE" ]);
|
type = extCommasEnum [ "block" "insert" "all" "onemore" "none" "NONE" ];
|
||||||
vimDefault = [ ];
|
vimDefault = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Virtual editing means that the cursor can be positioned where there is
|
Virtual editing means that the cursor can be positioned where there is
|
||||||
|
@ -144,7 +144,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
backupcopy = {
|
backupcopy = {
|
||||||
type = listOf (enum [ "yes" "no" "auto" "breaksymlink" "breakhardlink" ]);
|
type = extCommasEnum [ "yes" "no" "auto" "breaksymlink" "breakhardlink" ];
|
||||||
vimDefault = [ "auto" ];
|
vimDefault = [ "auto" ];
|
||||||
description = ''
|
description = ''
|
||||||
When writing a file and a backup is made, this option tells how it's
|
When writing a file and a backup is made, this option tells how it's
|
||||||
|
@ -457,7 +457,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
backspace = {
|
backspace = {
|
||||||
type = listOf (enum [ "indent" "eol" "start" "nostop" ]);
|
type = extCommasEnum [ "indent" "eol" "start" "nostop" ];
|
||||||
vimDefault = [ "indent" "eol" "start" ];
|
vimDefault = [ "indent" "eol" "start" ];
|
||||||
description = ''
|
description = ''
|
||||||
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
|
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
|
||||||
|
@ -521,7 +521,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
belloff = {
|
belloff = {
|
||||||
type = listOf (enum [
|
type = extCommasEnum [
|
||||||
"all"
|
"all"
|
||||||
"backspace"
|
"backspace"
|
||||||
"cursor"
|
"cursor"
|
||||||
|
@ -539,7 +539,7 @@ let
|
||||||
"shell"
|
"shell"
|
||||||
"spell"
|
"spell"
|
||||||
"willmode"
|
"willmode"
|
||||||
]);
|
];
|
||||||
vimDefault = [ "all" ];
|
vimDefault = [ "all" ];
|
||||||
description = ''
|
description = ''
|
||||||
Specifies for which events the bell will not be rung. It is a comma-
|
Specifies for which events the bell will not be rung. It is a comma-
|
||||||
|
@ -596,7 +596,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
casemap = {
|
casemap = {
|
||||||
type = listOf (enum [ "internal" "keepascii" ]);
|
type = extCommasEnum [ "internal" "keepascii" ];
|
||||||
vimDefault = [ "internal" "keepascii" ];
|
vimDefault = [ "internal" "keepascii" ];
|
||||||
description = ''
|
description = ''
|
||||||
Specifies details about changing the case of letters. It may contain
|
Specifies details about changing the case of letters. It may contain
|
||||||
|
@ -654,14 +654,14 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
completeopt = {
|
completeopt = {
|
||||||
type = listOf (enum [
|
type = extCommasEnum [
|
||||||
"menu"
|
"menu"
|
||||||
"menuone"
|
"menuone"
|
||||||
"longest"
|
"longest"
|
||||||
"preview"
|
"preview"
|
||||||
"noinsert"
|
"noinsert"
|
||||||
"noselect"
|
"noselect"
|
||||||
]);
|
];
|
||||||
vimDefault = [ "menu" "preview" ];
|
vimDefault = [ "menu" "preview" ];
|
||||||
description = ''
|
description = ''
|
||||||
A comma-separated list of options for Insert mode completion |ins-completion|.
|
A comma-separated list of options for Insert mode completion |ins-completion|.
|
||||||
|
@ -695,7 +695,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
debug = {
|
debug = {
|
||||||
type = listOf (enum [ "msg" "throw" "beep" ]);
|
type = extCommasEnum [ "msg" "throw" "beep" ];
|
||||||
vimDefault = [ ];
|
vimDefault = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
These values can be used:
|
These values can be used:
|
||||||
|
@ -756,7 +756,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
display = {
|
display = {
|
||||||
type = listOf (enum [ "lastline" "truncate" "uhex" "msgsep" ]);
|
type = extCommasEnum [ "lastline" "truncate" "uhex" "msgsep" ];
|
||||||
vimDefault = [ "lastline" ];
|
vimDefault = [ "lastline" ];
|
||||||
description = ''
|
description = ''
|
||||||
Change the way text is displayed.
|
Change the way text is displayed.
|
||||||
|
@ -850,7 +850,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
fileformats = {
|
fileformats = {
|
||||||
type = listOf (enum [ "dos" "unix" "mac" ]);
|
type = extCommasEnum [ "dos" "unix" "mac" ];
|
||||||
vimDefault = ''
|
vimDefault = ''
|
||||||
Windows default: ["dos" "unix"],
|
Windows default: ["dos" "unix"],
|
||||||
Unix default: ["unix" "dos"]
|
Unix default: ["unix" "dos"]
|
||||||
|
@ -896,7 +896,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
foldopen = {
|
foldopen = {
|
||||||
type = listOf (enum [
|
type = extCommasEnum [
|
||||||
"all"
|
"all"
|
||||||
"block"
|
"block"
|
||||||
"hor"
|
"hor"
|
||||||
|
@ -908,7 +908,7 @@ let
|
||||||
"search"
|
"search"
|
||||||
"tag"
|
"tag"
|
||||||
"undo"
|
"undo"
|
||||||
]);
|
];
|
||||||
vimDefault = [
|
vimDefault = [
|
||||||
"block"
|
"block"
|
||||||
"hor"
|
"hor"
|
||||||
|
@ -1640,7 +1640,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
redrawdebug = {
|
redrawdebug = {
|
||||||
type = listOf (enum [ "compositor" "line" "flush" "nothrottle" "invalid" "nodelta" ]);
|
type = extCommasEnum [ "compositor" "line" "flush" "nothrottle" "invalid" "nodelta" ];
|
||||||
vimDefault = [ ];
|
vimDefault = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Flags to change the way redrawing works, for debugging purposes.
|
Flags to change the way redrawing works, for debugging purposes.
|
||||||
|
@ -1748,7 +1748,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
scrollopt = {
|
scrollopt = {
|
||||||
type = listOf (enum [ "ver" "hor" "jump" ]);
|
type = extCommasEnum [ "ver" "hor" "jump" ];
|
||||||
vimDefault = [ "ver" "jump" ];
|
vimDefault = [ "ver" "jump" ];
|
||||||
description = ''
|
description = ''
|
||||||
This is a comma-separated list of words that specifies how
|
This is a comma-separated list of words that specifies how
|
||||||
|
@ -1769,7 +1769,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionoptions = {
|
sessionoptions = {
|
||||||
type = listOf (enum [
|
type = extCommasEnum [
|
||||||
"blank"
|
"blank"
|
||||||
"buffers"
|
"buffers"
|
||||||
"curdir"
|
"curdir"
|
||||||
|
@ -1785,7 +1785,7 @@ let
|
||||||
"terminal"
|
"terminal"
|
||||||
"winpos"
|
"winpos"
|
||||||
"winsize"
|
"winsize"
|
||||||
]);
|
];
|
||||||
vimDefault = [
|
vimDefault = [
|
||||||
"blank"
|
"blank"
|
||||||
"buffers"
|
"buffers"
|
||||||
|
@ -2214,7 +2214,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
switchbuf = {
|
switchbuf = {
|
||||||
type = listOf (enum [ "useopen" "usetab" "split" "vsplit" "newtab" "uselast" ]);
|
type = extCommasEnum [ "useopen" "usetab" "split" "vsplit" "newtab" "uselast" ];
|
||||||
vimDefault = [ "uselast" ];
|
vimDefault = [ "uselast" ];
|
||||||
description = ''
|
description = ''
|
||||||
This option controls the behavior when switching between buffers.
|
This option controls the behavior when switching between buffers.
|
||||||
|
@ -2311,7 +2311,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
termpastefilter = {
|
termpastefilter = {
|
||||||
type = listOf (enum [ "BS" "HT" "FF" "ESC" "DEL" "C0" "C1" ]);
|
type = extCommasEnum [ "BS" "HT" "FF" "ESC" "DEL" "C0" "C1" ];
|
||||||
vimDefault = [ "BS" "HT" "ESC" "DEL" ];
|
vimDefault = [ "BS" "HT" "ESC" "DEL" ];
|
||||||
description = ''
|
description = ''
|
||||||
list of options for specifying control characters
|
list of options for specifying control characters
|
||||||
|
@ -2530,7 +2530,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
viewoptions = {
|
viewoptions = {
|
||||||
type = listOf (enum [ "cursor" "curdir" "folds" "options" "localoptions" "slash" "unix" ]);
|
type = extCommasEnum [ "cursor" "curdir" "folds" "options" "localoptions" "slash" "unix" ];
|
||||||
vimDefault = [ "folds" "cursor" "curdir" ];
|
vimDefault = [ "folds" "cursor" "curdir" ];
|
||||||
description = ''
|
description = ''
|
||||||
Changes the effect of the |:mkview| command.
|
Changes the effect of the |:mkview| command.
|
||||||
|
@ -2557,7 +2557,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
whichwrap = {
|
whichwrap = {
|
||||||
type = listOf (enum [ "b" "s" "h" "l" "<" ">" "~" "[" "]" ]);
|
type = extCommasEnum [ "b" "s" "h" "l" "<" ">" "~" "[" "]" ];
|
||||||
vimDefault = [ "b" "s" ];
|
vimDefault = [ "b" "s" ];
|
||||||
description = ''
|
description = ''
|
||||||
Allow specified keys that move the cursor left/right to move to the
|
Allow specified keys that move the cursor left/right to move to the
|
||||||
|
@ -2672,7 +2672,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
wildoptions = {
|
wildoptions = {
|
||||||
type = listOf (enum [ "fuzzy" "pum" "tagfile" ]);
|
type = extCommasEnum [ "fuzzy" "pum" "tagfile" ];
|
||||||
vimDefault = [ "pum" "tagfile" ];
|
vimDefault = [ "pum" "tagfile" ];
|
||||||
description = ''
|
description = ''
|
||||||
A list of words that change how |cmdline-completion| is done.
|
A list of words that change how |cmdline-completion| is done.
|
||||||
|
@ -2953,7 +2953,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
cursorlineopt = {
|
cursorlineopt = {
|
||||||
type = listOf (enum [ "line" "screenline" "number" "both" ]);
|
type = extCommasEnum [ "line" "screenline" "number" "both" ];
|
||||||
vimDefault = [ "number" "line" ];
|
vimDefault = [ "number" "line" ];
|
||||||
description = ''
|
description = ''
|
||||||
list of settings for how 'cursorline' is displayed.
|
list of settings for how 'cursorline' is displayed.
|
||||||
|
@ -3889,7 +3889,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
nrformats = {
|
nrformats = {
|
||||||
type = listOf (enum [ "alpha" "octal" "hex" "bin" "unsigned" ]);
|
type = extCommasEnum [ "alpha" "octal" "hex" "bin" "unsigned" ];
|
||||||
vimDefault = [ "bin" "hex" ];
|
vimDefault = [ "bin" "hex" ];
|
||||||
description = ''
|
description = ''
|
||||||
This defines what bases Vim will consider for numbers when using the
|
This defines what bases Vim will consider for numbers when using the
|
||||||
|
@ -4052,7 +4052,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
spelloptions = {
|
spelloptions = {
|
||||||
type = listOf (enum [ "camel" "noplainbuffer" ]);
|
type = extCommasEnum [ "camel" "noplainbuffer" ];
|
||||||
vimDefault = [ ];
|
vimDefault = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
list of options for spell checking:
|
list of options for spell checking:
|
||||||
|
|
Loading…
Reference in a new issue