summaryrefslogtreecommitdiff
path: root/src/evalvars.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-05 11:05:57 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-05 11:05:57 +0000
commit330a388e18ad6b64c3574c712db675258b0e9878 (patch)
tree99c61b05a3986cb741ff507dddf3ca7e94bd7171 /src/evalvars.c
parentf78ee2b49f0b060c642764a620b4c55ab13af82e (diff)
downloadvim-git-330a388e18ad6b64c3574c712db675258b0e9878.tar.gz
patch 8.2.4508: Vim9: cannot assign to a global variable on the command linev8.2.4508
Problem: Vim9: cannot assign to a global variable on the command line. Solution: Allow using :vim9cmd for assignment on the command line.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r--src/evalvars.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index 260c297b0..40e643b9f 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -754,12 +754,14 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
void
ex_var(exarg_T *eap)
{
+ char_u *p = eap->cmd;
+
if (!in_vim9script())
{
semsg(_(e_str_cannot_be_used_in_legacy_vim_script), ":var");
return;
}
- if (current_sctx.sc_sid == 0)
+ if (current_sctx.sc_sid == 0 && checkforcmd_noparen(&p, "var", 3))
{
emsg(_(e_cannot_declare_variable_on_command_line));
return;