Skip to content

Commit

Permalink
Merge pull request #18534 from neovim/backport-18480-to-release-0.7
Browse files Browse the repository at this point in the history
[Backport release-0.7] fix(runtime/genvimvim): omit s[ubstitute] from vimCommand
  • Loading branch information
zeertzjq committed May 12, 2022
2 parents 35075dc + 0377973 commit 496e786
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions runtime/syntax/vim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ else
com! -nargs=* VimFoldt <args>
endif

" commands not picked up by the generator (due to non-standard format) {{{2
syn keyword vimCommand contained py3

" Deprecated variable options {{{2
if exists("g:vim_minlines")
let g:vimsyn_minlines= g:vim_minlines
Expand Down
9 changes: 5 additions & 4 deletions scripts/genvimvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand All @@ -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
Expand Down

0 comments on commit 496e786

Please sign in to comment.