diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-01-27 02:00:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 17:00:50 -0800 |
commit | c2433589dca022a7f40cdcbd0cd1ad8aba6ee4a9 (patch) | |
tree | 4ec42e5d42d7c0bb5e674af2e94e1fe3eac2c837 /src/nvim/lua/executor.c | |
parent | 0892c080d16776366a2fe289f9083cdc532ec56c (diff) | |
download | rneovim-c2433589dca022a7f40cdcbd0cd1ad8aba6ee4a9.tar.gz rneovim-c2433589dca022a7f40cdcbd0cd1ad8aba6ee4a9.tar.bz2 rneovim-c2433589dca022a7f40cdcbd0cd1ad8aba6ee4a9.zip |
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
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |