mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
vim-patch:4ba70cab37d2 (#28338)
runtime(vim): Update base-syntax, fix nested function folding (vim/vim#14397)
Only match function folding start and end patterns at the start of a
line, excluding heredocs and :append/:change/:insert commands.
Fixes vim/vim#14393
4ba70cab37
Co-authored-by: dkearns <dougkearns@gmail.com>
This commit is contained in:
parent
bcfad7fe62
commit
0f5c94c04b
@ -181,9 +181,9 @@ syn cluster vimExprList contains=vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,
|
||||
" (buftype != nofile test avoids having append, change, insert show up in the command window)
|
||||
" =======================
|
||||
if &buftype != 'nofile'
|
||||
syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=a\%[ppend]$" matchgroup=vimCommand end="^\.$""
|
||||
syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=c\%[hange]$" matchgroup=vimCommand end="^\.$""
|
||||
syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=i\%[nsert]$" matchgroup=vimCommand end="^\.$""
|
||||
syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=a\%[ppend]$" matchgroup=vimCommand end="^\.$" extend
|
||||
syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=c\%[hange]$" matchgroup=vimCommand end="^\.$" extend
|
||||
syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=i\%[nsert]$" matchgroup=vimCommand end="^\.$" extend
|
||||
endif
|
||||
|
||||
" Behave! {{{2
|
||||
@ -234,12 +234,14 @@ if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror")
|
||||
syn match vimOperError ")"
|
||||
endif
|
||||
|
||||
" Functions : Tag is provided for those who wish to highlight tagged functions {{{2
|
||||
" Functions: Tag is provided for those who wish to highlight tagged functions {{{2
|
||||
" =========
|
||||
syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFuncSID,Tag
|
||||
syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag
|
||||
syn cluster vimFuncBodyList contains=@vimCmdList,vimCmplxRepeat,vimComment,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimLetHereDoc,vimLineComment,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst
|
||||
syn cluster vimDefBodyList contains=@vimCmdList,vimCmplxRepeat,vim9Comment,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vim9LineComment,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst
|
||||
|
||||
syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold
|
||||
syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert
|
||||
syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment
|
||||
|
||||
syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList
|
||||
syn match vimFunction "\<fu\%[nction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey
|
||||
@ -273,9 +275,9 @@ syn match vimEndfunction "\<endf\%[unction]\>"
|
||||
syn match vimEnddef "\<enddef\>"
|
||||
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
|
||||
syn region vimFuncFold start="\<fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="\<endf\%[unction]\>" contains=vimFunction fold keepend transparent
|
||||
syn region vimFuncFold start="\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="\<enddef\>" contains=vimDef fold keepend transparent
|
||||
syn region vimFuncFold start="\<def\s\+new\i\+(" end="\<enddef\>" contains=vimDef fold keepend transparent
|
||||
syn region vimFuncFold start="^\s*:\=\s*fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="^\s*:\=\s*endf\%[unction]\>" contains=vimFunction fold keepend extend transparent
|
||||
syn region vimFuncFold start="^\s*:\=\s*def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="^\s*:\=\s*enddef\>" contains=vimDef fold keepend extend transparent
|
||||
syn region vimFuncFold start="^\s*:\=\s*def\s\+new\i\+(" end="^\s*:\=\s*enddef\>" contains=vimDef fold keepend extend transparent
|
||||
endif
|
||||
|
||||
syn match vimFuncVar contained "a:\%(\K\k*\|\d\+\)\>"
|
||||
@ -492,7 +494,8 @@ syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
|
||||
syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
|
||||
syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber
|
||||
|
||||
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
|
||||
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' extend
|
||||
syn keyword vimLet var skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc
|
||||
|
||||
" For: {{{2
|
||||
" ===
|
||||
|
Loading…
Reference in New Issue
Block a user