From c04bd96eeb3bed19f23d394bebb6193bcd5271da Mon Sep 17 00:00:00 2001 From: Ben Lubas Date: Thu, 21 Nov 2024 18:14:32 -0500 Subject: [PATCH] feat: support ranges in Neorg command, --- lua/neorg/modules/core/neorgcmd/module.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/neorg/modules/core/neorgcmd/module.lua b/lua/neorg/modules/core/neorgcmd/module.lua index 5c02cc047..4a1973d55 100644 --- a/lua/neorg/modules/core/neorgcmd/module.lua +++ b/lua/neorg/modules/core/neorgcmd/module.lua @@ -97,6 +97,7 @@ module.load = function() vim.api.nvim_create_user_command("Neorg", module.private.command_callback, { nargs = "*", complete = module.private.generate_completions, + range = 2, }) -- Loop through all the command modules we want to load and load them @@ -295,12 +296,14 @@ module.private = { module.events.defined[ref.name] = modules.define_event(module, ref.name) end + local content = vim.list_slice(args, argument_index + 1) + content["data"] = data modules.broadcast_event( assert( modules.create_event( module, table.concat({ "core.neorgcmd.events.", ref.name }), - vim.list_slice(args, argument_index + 1) + content ) ) )