From c24b442e310f06c3ad9d4763b09bc9cb7dbaca62 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Thu, 12 May 2022 01:08:25 +0100 Subject: fix(runtime/genvimvim): omit s[ubstitute] from vimCommand #18480 It's special cased by the vimSubst syntax group, and isn't present in Vim's vimCommand group. For example, this fixes `call s:Foo()` highlighting `:` as Error in Nvim, as the `s` is parsed as vimCommand rather than as vimUserFunc since `contains=vimCommand` was added to vimUserFunc (and vimFunc) in a rt update. Interestingly, `g:`, `l:`, etc. have the same issues due to :global, :list, etc. Vim also has that problem, so it should ideally be fixed upstream. We could also omit g[lobal] from vimCommand and rely on vimGlobal instead, but it doesn't work in some cases, like when there's a `:` before the command. Also, Vim matches only `g` in vimCommand for some reason, which doesn't produce any highlight for `:global/foo/bar` (with Nvim you at least get some highlights on the `global` bit despite the leading `:`). Also, remove special handling of :py3 in syntax/vim.vim, as the generator seems to have no problems finding it. --- scripts/genvimvim.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts/genvimvim.lua') diff --git a/scripts/genvimvim.lua b/scripts/genvimvim.lua index ff60b6cce7..7e9d649cb4 100644 --- a/scripts/genvimvim.lua +++ b/scripts/genvimvim.lua @@ -44,12 +44,13 @@ local function cmd_kw(prev_cmd, cmd) end -- Exclude these from the vimCommand keyword list, they are handled specially --- in syntax/vim.vim (vimAugroupKey, vimAutoCmd). #9327 -local function is_autocmd_cmd(cmd) +-- in syntax/vim.vim (vimAugroupKey, vimAutoCmd, vimSubst). #9327 +local function is_special_cased_cmd(cmd) return (cmd == 'augroup' or cmd == 'autocmd' or cmd == 'doautocmd' - or cmd == 'doautoall') + or cmd == 'doautoall' + or cmd == 'substitute') end local vimcmd_start = 'syn keyword vimCommand contained ' @@ -60,7 +61,7 @@ for _, cmd_desc in ipairs(ex_cmds.cmds) do w('\n' .. vimcmd_start) end local cmd = cmd_desc.command - if cmd:match('%w') and cmd ~= 'z' and not is_autocmd_cmd(cmd) then + if cmd:match('%w') and cmd ~= 'z' and not is_special_cased_cmd(cmd) then w(' ' .. cmd_kw(prev_cmd, cmd)) end prev_cmd = cmd -- cgit From 504d7decbdef55d58e62217a0a54cbee2a0944cc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 15 Jun 2022 09:20:32 +0200 Subject: vim-patch:8c1b8cb2e0b5 (#18966) Update runtime files https://github.com/vim/vim/commit/8c1b8cb2e0b52d0853f85c2096a2f22dbc57a788 --- scripts/genvimvim.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/genvimvim.lua') diff --git a/scripts/genvimvim.lua b/scripts/genvimvim.lua index 7e9d649cb4..868084a583 100644 --- a/scripts/genvimvim.lua +++ b/scripts/genvimvim.lua @@ -44,12 +44,13 @@ local function cmd_kw(prev_cmd, cmd) end -- Exclude these from the vimCommand keyword list, they are handled specially --- in syntax/vim.vim (vimAugroupKey, vimAutoCmd, vimSubst). #9327 +-- in syntax/vim.vim (vimAugroupKey, vimAutoCmd, vimGlobal, vimSubst). #9327 local function is_special_cased_cmd(cmd) return (cmd == 'augroup' or cmd == 'autocmd' or cmd == 'doautocmd' or cmd == 'doautoall' + or cmd == 'global' or cmd == 'substitute') end -- cgit