1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-21 17:59:41 +01:00

treewide: remove internal use of helpers module arg

This commit is contained in:
Matt Sturgeon 2025-11-19 11:39:41 +00:00
parent 7add68e918
commit dad19c1238
68 changed files with 687 additions and 758 deletions

View file

@ -1,9 +1,4 @@
{
lib,
helpers,
config,
...
}:
{ lib, config, ... }:
let
commandAttributes = lib.types.submodule {
options = {
@ -13,7 +8,7 @@ let
};
nargs =
helpers.mkNullOrOption
lib.nixvim.mkNullOrOption
(lib.types.enum [
0
1
@ -24,11 +19,11 @@ let
''
The number of arguments to expect, see :h command-nargs.
'';
complete = helpers.mkNullOrOption (with lib.types; either str rawLua) ''
complete = lib.nixvim.mkNullOrOption (with lib.types; either str rawLua) ''
Tab-completion behaviour, see :h command-complete.
'';
range =
helpers.mkNullOrOption
lib.nixvim.mkNullOrOption
(
with lib.types;
oneOf [
@ -40,18 +35,18 @@ let
''
Whether the command accepts a range, see :h command-range.
'';
count = helpers.mkNullOrOption (with lib.types; either bool int) ''
count = lib.nixvim.mkNullOrOption (with lib.types; either bool int) ''
Whether the command accepts a count, see :h command-range.
'';
addr = helpers.mkNullOrOption lib.types.str ''
addr = lib.nixvim.mkNullOrOption lib.types.str ''
Whether special characters relate to other things, see :h command-addr.
'';
bang = helpers.defaultNullOpts.mkBool false "Whether this command can take a bang (!).";
bar = helpers.defaultNullOpts.mkBool false "Whether this command can be followed by a \"|\" and another command.";
register = helpers.defaultNullOpts.mkBool false "The first argument to the command can be an optional register.";
keepscript = helpers.defaultNullOpts.mkBool false "Do not use the location of where the user command was defined for verbose messages, use the location of where the command was invoked.";
force = helpers.defaultNullOpts.mkBool false "Overwrite an existing user command.";
desc = helpers.defaultNullOpts.mkStr "" "A description of the command.";
bang = lib.nixvim.defaultNullOpts.mkBool false "Whether this command can take a bang (!).";
bar = lib.nixvim.defaultNullOpts.mkBool false "Whether this command can be followed by a \"|\" and another command.";
register = lib.nixvim.defaultNullOpts.mkBool false "The first argument to the command can be an optional register.";
keepscript = lib.nixvim.defaultNullOpts.mkBool false "Do not use the location of where the user command was defined for verbose messages, use the location of where the command was invoked.";
force = lib.nixvim.defaultNullOpts.mkBool false "Overwrite an existing user command.";
desc = lib.nixvim.defaultNullOpts.mkStr "" "A description of the command.";
# TODO: command-preview, need to grab a function here.
};
@ -72,7 +67,7 @@ in
};
in
lib.mkIf (config.userCommands != { }) {
extraConfigLua = helpers.wrapDo ''
extraConfigLua = lib.nixvim.wrapDo ''
local cmds = ${lib.nixvim.toLuaObject (lib.mapAttrs cleanupCommand config.userCommands)};
for name,cmd in pairs(cmds) do
vim.api.nvim_create_user_command(name, cmd.command, cmd.options or {})