neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 4091f2c74040c3e92f504e727d7533e09ef84d3a
parent 7a8b0cd0f85ad2b488e943ecbcd085f1fbccf020
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun,  1 Jun 2025 08:31:56 +0800

vim-patch:7b5550f: runtime(vim): Update base-syntax, improve :import highlighting

- Match "autoload" as a keyword in :import commands.
- Match an expression argument for the filename.

closes: vim/vim#15375

https://github.com/vim/vim/commit/7b5550fac7d37f35285c78a8e74674817a7cfc99

Co-authored-by: Doug Kearns <dougkearns@gmail.com>

Diffstat:
Mruntime/syntax/vim.vim | 48++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim @@ -219,7 +219,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=@vi syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimFor,vimFunction,vimFuncFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutocmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDoautocmd,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimElse,vimEnddef,vimEndfunction,vimEndif,vimExecute,vimIsCommand,vimExtCmd,vimExFilter,vimFor,vimFunction,vimFuncFold,vimGrep,vimGrepAdd,vimGlobal,vimHelpgrep,vimHighlight,vimImport,vimLet,vimLoadkeymap,vimLockvar,vimMake,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimRedir,vimSet,vimSleep,vimSort,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimVimgrep,vimVimgrepadd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList,vimLua,vimMzScheme,vimPerl,vimPython,vimPython3,vimPythonX,vimRuby,vimTcl syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1 @@ -306,6 +306,47 @@ endif syn keyword vimFTCmd contained filet[ype] syn keyword vimFTOption contained detect indent off on plugin +" Import {{{2 +" ====== +syn keyword vimImportAutoload contained autoload skipwhite nextgroup=vimImportFilename +if s:vim9script + syn region vimImportFilename contained + \ start="\S" + \ skip=+\%#=1 + "\ continuation operators at SOL + \\n\%(\s*#.*\n\)*\s*\%([[:punct:]]\+\&[^#"'(]\) + \\| + "\ continuation operators at EOL + \\%(\%([[:punct:]]\+\&[^#"')]\)\s*\%(#.*\)\=\)\@<=$ + \\| + \\n\%(\s*#.*\n\)*\s*as\s + \\| + \\%(^\s*#.*\)\@<=$ + \\| + \\n\s*\\\|\n\s*#\\ + \+ + \ matchgroup=vimCommand + \ end="\s\+\zsas\ze\s\+\h" + \ matchgroup=NONE + \ end="$" + \ skipwhite nextgroup=vimImportName + \ contains=@vim9Continue,@vimExprList,vim9Comment + \ transparent +else + syn region vimImportFilename contained + \ start="\S" + \ skip=+\n\s*\\\|\n\s*"\\ + + \ matchgroup=vimCommand + \ end="\s\+\zsas\ze\s\+\h" + \ matchgroup=NONE + \ end="$" + \ skipwhite nextgroup=vimImportName + \ contains=@vimContinue,@vimExprList + \ transparent +endif +syn match vimImportName contained "\%(\<as\s\+\)\@<=\h\w*\>" skipwhite nextgroup=@vimComment +syn match vimImport "\<imp\%[ort]\>" skipwhite nextgroup=vimImportAutoload,vimImportFilename + " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. syn cluster vimAugroupList contains=@vimCmdList,vimFilter,vimFunc,vimLineComment,vimSpecFile,vimOper,vimNumber,vimOperParen,@vimComment,vimString,vimSubst,vimRegister,vimCmplxRepeat,vimNotation,vimCtrlChar,vimContinue @@ -1878,7 +1919,7 @@ if exists("g:vimsyn_minlines") endif exe "syn sync maxlines=".s:vimsyn_maxlines syn sync linecont "^\s\+\\" -syn sync linebreaks=1 +syn sync linebreaks=2 syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]" " ==================== @@ -2012,6 +2053,9 @@ if !exists("skip_vim_syntax_inits") hi def link vimHiStartStop vimHiTerm hi def link vimHiTerm Type hi def link vimHLGroup vimGroup + hi def link vimImport vimCommand + hi def link vimImportAutoload Special + hi def link vimImportAs vimImport hi def link vimInsert vimString hi def link vim9KeymapLineComment vimKeymapLineComment hi def link vimKeymapLineComment vimComment