Skip to content

Commit

Permalink
Correct snipGlobal syntax regions (#1462)
Browse files Browse the repository at this point in the history
The previous syntax group for snipGlobal was not matching and including the endglobal keyword, resulting in a wrong folding region.

This commit fixes this, to make the endglobal keyword matched and correctly included in the snipGlobal syntax region.
  • Loading branch information
wookayin authored Jun 7, 2022
1 parent 28ab3f2 commit 5fc4862
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions syntax/snippets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ syn cluster snipTabStopTokens add=snipTransformation

" Generic (non-Python) {{{4

syn region snipGlobal start="^global\_s" end="^\zeendglobal\s*$" contains=snipGlobalHeader nextgroup=snipGlobalFooter fold keepend
syn region snipGlobal start="^global\_s" end="^endglobal\s*$" contains=snipGlobalHeader fold keepend
syn match snipGlobalHeader "^.*$" nextgroup=snipGlobalBody,snipGlobalFooter skipnl contained contains=snipGlobalHeaderKeyword
syn region snipGlobalBody start="\_." end="^\zeendglobal\s*$" contained contains=snipLeadingSpaces
syn region snipGlobalBody start="\_." end="^\zeendglobal\s*$" contained nextgroup=snipGlobalFooter contains=snipLeadingSpaces

" Python (!p) {{{4

syn region snipGlobal start=,^global\s\+!p\%(\s\+"[^"]*\%("\s\+[^"[:space:]]\+\|"\)\=\)\=\s*$, end=,^\zeendglobal\s*$, contains=snipGlobalPHeader nextgroup=snipGlobalFooter fold keepend
syn region snipGlobal start=,^global\s\+!p\%(\s\+"[^"]*\%("\s\+[^"[:space:]]\+\|"\)\=\)\=\s*$, end=,^endglobal\s*$, contains=snipGlobalPHeader fold keepend
syn match snipGlobalPHeader "^.*$" nextgroup=snipGlobalPBody,snipGlobalFooter skipnl contained contains=snipGlobalHeaderKeyword
syn match snipGlobalHeaderKeyword "^global" contained nextgroup=snipSnippetTrigger skipwhite
syn region snipGlobalPBody start="\_." end="^\zeendglobal\s*$" contained contains=@Python
syn region snipGlobalPBody start="\_." end="^\zeendglobal\s*$" contained nextgroup=snipGlobalFooter contains=@Python

" Common {{{4

Expand Down

0 comments on commit 5fc4862

Please sign in to comment.