summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-21 20:50:35 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-21 20:50:35 +0200
commitbf5f2878333da934a8bdc560bf0bcf9a88ff86a1 (patch)
tree2e41e267215698d5131d9f9ab8aecf4ed13637e6 /src/ex_docmd.c
parentbebf06954e1c801870b57e06ab03151c2654d079 (diff)
patch 8.2.3365: Vim9: cannot use option for all operationsv8.2.3365
Problem: Vim9: cannot use option for all operations. Solution: Recognize more operations. (closes #8779)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index d29a932653..4eee8fe9ce 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3425,12 +3425,26 @@ find_ex_command(
{
char_u *pskip = skip_option_env_lead(eap->cmd);
- if (vim_strchr((char_u *)"{('[\"@", *p) != NULL
+ if (vim_strchr((char_u *)"{('[\"@&", *p) != NULL
|| ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL))
{
int oplen;
int heredoc;
- char_u *swp = skipwhite(p);
+ char_u *swp;
+
+ if (*eap->cmd == '&')
+ {
+ p = to_name_end(eap->cmd + 1, FALSE);
+ if (ends_excmd(*skipwhite(p)))
+ {
+ // "&option <NL>" is the start of an expression.
+ eap->cmdidx = CMD_eval;
+ return eap->cmd;
+ }
+ // "&option" can be followed by "->" or "=", check below
+ }
+
+ swp = skipwhite(p);
if (
// "(..." is an expression.
@@ -3530,10 +3544,14 @@ find_ex_command(
// Recognize an assignment if we recognize the variable name:
// "g:var = expr"
+ // "@r = expr"
+ // "&opt = expr"
// "var = expr" where "var" is a variable name or we are skipping
// (variable declaration might have been skipped).
if (*eap->cmd == '@')
p = eap->cmd + 2;
+ else if (*eap->cmd == '&')
+ p = skiptowhite_esc(eap->cmd + 1);
oplen = assignment_len(skipwhite(p), &heredoc);
if (oplen > 0)
{