summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-10-13 15:04:34 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-13 15:04:34 +0100
commit7b829268921e8fc1c63c34d245063c1c4e7d21af (patch)
treea98bfde122c275ec816159fadb69b7280d1dc380 /src/ex_docmd.c
parentfff10d9a76099aa9b944f3c33a911127ca1a0c72 (diff)
patch 8.2.3503: Vim9: using g:pat:cmd is confusingv8.2.3503
Problem: Vim9: using g:pat:cmd is confusing. Solution: Do not recognize g: as the :global command. Also for s:pat:repl. (closes #8982)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 08a48305ed..072effdec4 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3600,6 +3600,15 @@ find_ex_command(
}
}
+ // "g:", "s:" and "l:" are always assumed to be a variable, thus start
+ // an expression. A global/substitute/list command needs to use a
+ // longer name.
+ if (vim_strchr((char_u *)"gsl", *p) != NULL && p[1] == ':')
+ {
+ eap->cmdidx = CMD_eval;
+ return eap->cmd;
+ }
+
// If it is an ID it might be a variable with an operator on the next
// line, if the variable exists it can't be an Ex command.
if (p > eap->cmd && ends_excmd(*skipwhite(p))