From c2433589dca022a7f40cdcbd0cd1ad8aba6ee4a9 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sat, 27 Jan 2024 02:00:50 +0100 Subject: feat(ex_cmds): ranged :lua #27167 :{range}lua executes the specified lines in the current buffer as Lua code, regardless of its extension or 'filetype'. Close #27103 --- src/nvim/lua/executor.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/lua/executor.c') diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index f48cab6739..3139e924a1 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1649,6 +1649,15 @@ bool nlua_is_deferred_safe(void) void ex_lua(exarg_T *const eap) FUNC_ATTR_NONNULL_ALL { + if (eap->addr_count > 0 || *eap->arg == NUL) { + if (eap->addr_count > 0 && *eap->arg == NUL) { + cmd_source_buffer(eap, true); + } else { + semsg(_(e_invarg2), "exactly one of {chunk} and {range} required"); + } + return; + } + size_t len; char *code = script_get(eap, &len); if (eap->skip || code == NULL) { -- cgit