0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3503: Vim9: using g:pat:cmd is confusing

Problem:    Vim9: using g:pat:cmd is confusing.
Solution:   Do not recognize g: as the :global command.  Also for s:pat:repl.
            (closes #8982)
This commit is contained in:
Bram Moolenaar
2021-10-13 15:04:34 +01:00
parent fff10d9a76
commit 7b82926892
8 changed files with 111 additions and 1 deletions

View File

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