0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.4508: Vim9: cannot assign to a global variable on the command line

Problem:    Vim9: cannot assign to a global variable on the command line.
Solution:   Allow using :vim9cmd for assignment on the command line.
This commit is contained in:
Bram Moolenaar
2022-03-05 11:05:57 +00:00
parent f78ee2b49f
commit 330a388e18
5 changed files with 15 additions and 2 deletions

View File

@@ -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;