From 1c9f2a23a6cb9406c35980f4af1a4356f56771e9 Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Tue, 21 May 2024 12:38:48 +0100 Subject: [PATCH] modules/commands: allow commands to be raw lua --- modules/commands.nix | 2 +- tests/test-sources/modules/commands.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/commands.nix b/modules/commands.nix index 9ca743e2..ebf730af 100644 --- a/modules/commands.nix +++ b/modules/commands.nix @@ -9,7 +9,7 @@ let commandAttributes = types.submodule { options = { command = mkOption { - type = types.str; + type = with helpers.nixvimTypes; either str rawLua; description = "The command to run."; }; diff --git a/tests/test-sources/modules/commands.nix b/tests/test-sources/modules/commands.nix index 5597e12a..efa12789 100644 --- a/tests/test-sources/modules/commands.nix +++ b/tests/test-sources/modules/commands.nix @@ -9,6 +9,14 @@ "Z" = { command = ":echo fooo"; }; + "InsertHere" = { + command.__raw = '' + function(opts) + vim.api.nvim_put({opts.args}, 'c', true, true) + end + ''; + nargs = 1; + }; }; }; }