mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
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
7b5550fac7
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
@@ -219,7 +219,7 @@ syn match vimNumber '\<0z\%(\x\x\)\+\%(\.\%(\x\x\)\+\)*' skipwhite nextgroup=@vi
|
|||||||
syn case match
|
syn case match
|
||||||
|
|
||||||
" All vimCommands are contained by vimIsCommand. {{{2
|
" 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 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 "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc
|
||||||
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
|
syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
|
||||||
@@ -306,6 +306,47 @@ endif
|
|||||||
syn keyword vimFTCmd contained filet[ype]
|
syn keyword vimFTCmd contained filet[ype]
|
||||||
syn keyword vimFTOption contained detect indent off on plugin
|
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
|
" Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2
|
||||||
" ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking.
|
" ======= : 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
|
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
|
endif
|
||||||
exe "syn sync maxlines=".s:vimsyn_maxlines
|
exe "syn sync maxlines=".s:vimsyn_maxlines
|
||||||
syn sync linecont "^\s\+\\"
|
syn sync linecont "^\s\+\\"
|
||||||
syn sync linebreaks=1
|
syn sync linebreaks=2
|
||||||
syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]"
|
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 vimHiStartStop vimHiTerm
|
||||||
hi def link vimHiTerm Type
|
hi def link vimHiTerm Type
|
||||||
hi def link vimHLGroup vimGroup
|
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 vimInsert vimString
|
||||||
hi def link vim9KeymapLineComment vimKeymapLineComment
|
hi def link vim9KeymapLineComment vimKeymapLineComment
|
||||||
hi def link vimKeymapLineComment vimComment
|
hi def link vimKeymapLineComment vimComment
|
||||||
|
Reference in New Issue
Block a user