From c97afcbf8213d88f61da42356046fd093e037347 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 20 Jan 2024 14:45:30 +0100 Subject: [PATCH] modules/commands: fix lua cmd.options value when no options are set --- modules/commands.nix | 2 +- tests/test-sources/modules/commands.nix | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/commands.nix b/modules/commands.nix index 5a37a481..dd508f64 100644 --- a/modules/commands.nix +++ b/modules/commands.nix @@ -54,7 +54,7 @@ in { extraConfigLua = helpers.wrapDo '' local cmds = ${helpers.toLuaObject (mapAttrs cleanupCommand config.userCommands)}; for name,cmd in pairs(cmds) do - vim.api.nvim_create_user_command(name, cmd.command, cmd.options) + vim.api.nvim_create_user_command(name, cmd.command, cmd.options or {}) end ''; }; diff --git a/tests/test-sources/modules/commands.nix b/tests/test-sources/modules/commands.nix index 96c5cf6e..f65a5016 100644 --- a/tests/test-sources/modules/commands.nix +++ b/tests/test-sources/modules/commands.nix @@ -5,6 +5,9 @@ command = ":w"; desc = "Write file"; }; + "Z" = { + command = ":echo fooo"; + }; }; }; }