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
This commit is contained in:
luukvbaal
2024-01-27 02:00:50 +01:00
committed by GitHub
parent 0892c080d1
commit c2433589dc
6 changed files with 48 additions and 5 deletions

View File

@@ -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) {