mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
helpers/keymaps: factor out mkModeOption
This commit is contained in:
parent
7edffe3896
commit
28d4d2a842
1 changed files with 16 additions and 10 deletions
|
@ -81,6 +81,21 @@ with lib; rec {
|
|||
|
||||
mapOptionSubmodule = mkMapOptionSubmodule {};
|
||||
|
||||
mkModeOption = default:
|
||||
mkOption {
|
||||
type = with types;
|
||||
either
|
||||
modeEnum
|
||||
(listOf modeEnum);
|
||||
description = ''
|
||||
One or several modes.
|
||||
Use the short-names (`"n"`, `"v"`, ...).
|
||||
See `:h map-modes` to learn more.
|
||||
'';
|
||||
inherit default;
|
||||
example = ["n" "v"];
|
||||
};
|
||||
|
||||
mkMapOptionSubmodule = defaults: (with types;
|
||||
submodule {
|
||||
options = {
|
||||
|
@ -95,16 +110,7 @@ with lib; rec {
|
|||
{default = defaults.key;}
|
||||
));
|
||||
|
||||
mode = mkOption {
|
||||
type = either modeEnum (listOf modeEnum);
|
||||
description = ''
|
||||
One or several modes.
|
||||
Use the short-names (`"n"`, `"v"`, ...).
|
||||
See `:h map-modes` to learn more.
|
||||
'';
|
||||
default = defaults.mode or "";
|
||||
example = ["n" "v"];
|
||||
};
|
||||
mode = mkModeOption defaults.mode or "";
|
||||
|
||||
action = mkOption ({
|
||||
type = nixvimTypes.maybeRaw str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue