helpers/keymap-helpers: do not import helpers.nix directly

This commit is contained in:
Gaetan Lepage 2024-02-09 14:51:47 +01:00 committed by Gaétan Lepage
parent 7dbf7f978c
commit ba818894b4
2 changed files with 16 additions and 14 deletions

View file

@ -5,7 +5,7 @@
in in
{ {
maintainers = import ./maintainers.nix; maintainers = import ./maintainers.nix;
keymaps = import ./keymap-helpers.nix {inherit lib;}; keymaps = import ./keymap-helpers.nix {inherit lib nixvimOptions nixvimTypes;};
autocmd = import ./autocmd-helpers.nix {inherit lib;}; autocmd = import ./autocmd-helpers.nix {inherit lib;};
neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions;}; neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions;};
vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;}; vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;};

View file

@ -1,39 +1,41 @@
{lib, ...}: {
with lib; let lib,
helpers = import ../lib/helpers.nix {inherit lib;}; nixvimOptions,
in rec { nixvimTypes,
}:
with lib; rec {
# These are the configuration options that change the behavior of each mapping. # These are the configuration options that change the behavior of each mapping.
mapConfigOptions = { mapConfigOptions = {
silent = silent =
helpers.defaultNullOpts.mkBool false nixvimOptions.defaultNullOpts.mkBool false
"Whether this mapping should be silent. Equivalent to adding <silent> to a map."; "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
nowait = nowait =
helpers.defaultNullOpts.mkBool false nixvimOptions.defaultNullOpts.mkBool false
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map."; "Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
script = script =
helpers.defaultNullOpts.mkBool false nixvimOptions.defaultNullOpts.mkBool false
"Equivalent to adding <script> to a map."; "Equivalent to adding <script> to a map.";
expr = expr =
helpers.defaultNullOpts.mkBool false nixvimOptions.defaultNullOpts.mkBool false
"Means that the action is actually an expression. Equivalent to adding <expr> to a map."; "Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
unique = unique =
helpers.defaultNullOpts.mkBool false nixvimOptions.defaultNullOpts.mkBool false
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map."; "Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
noremap = noremap =
helpers.defaultNullOpts.mkBool true nixvimOptions.defaultNullOpts.mkBool true
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default."; "Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
remap = remap =
helpers.defaultNullOpts.mkBool false nixvimOptions.defaultNullOpts.mkBool false
"Make the mapping recursive. Inverses \"noremap\""; "Make the mapping recursive. Inverses \"noremap\"";
desc = desc =
helpers.mkNullOrOption types.str nixvimOptions.mkNullOrOption types.str
"A textual description of this keybind, to be shown in which-key, if you have it."; "A textual description of this keybind, to be shown in which-key, if you have it.";
}; };
@ -105,7 +107,7 @@ in rec {
}; };
action = mkOption ({ action = mkOption ({
type = helpers.nixvimTypes.maybeRaw str; type = nixvimTypes.maybeRaw str;
description = "The action to execute."; description = "The action to execute.";
} }
// ( // (