diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2022-10-14 17:40:10 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2022-10-14 17:40:10 +0200 |
commit | bc8a81d3592dab86334f27d1d43c080ebf680d42 (patch) | |
tree | f367857d8c196d36f2d6dec3c2f6c9d703b06b7c /syntax/caddyfile.vim | |
parent | 38282d58387cff48ac203f6912c05e4c8686141b (diff) | |
download | vim-polyglot-bc8a81d3592dab86334f27d1d43c080ebf680d42.tar.gz vim-polyglot-bc8a81d3592dab86334f27d1d43c080ebf680d42.zip |
Update
Diffstat (limited to 'syntax/caddyfile.vim')
-rw-r--r-- | syntax/caddyfile.vim | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/syntax/caddyfile.vim b/syntax/caddyfile.vim index ab0c24d1..12300a7c 100644 --- a/syntax/caddyfile.vim +++ b/syntax/caddyfile.vim @@ -2,32 +2,51 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'caddyfile', 'syntax/caddyfile finish endif -" Language: Caddyfile -" Author: Josh Glendenning <josh@isobit.io> +" Language: Caddyfile +" Maintainer: 0az <0az@afzhou.com> +" Original Author: Josh Glendenning <josh@isobit.io> if exists("b:current_syntax") finish endif -syn match caddyDirective "^\s*\([a-zA-Z0-9_]\+\)" nextgroup=caddyDirectiveArgs skipwhite -syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString nextgroup=caddyDirectiveBlock skipwhite -syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment +syn match caddyDirective "\v^\s*(\w\S*)" nextgroup=caddyDirectiveArgs skipwhite +syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString,caddyNamedMatcher nextgroup=caddyDirectiveBlock skipwhite +syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment,caddyImport -syn match caddySubdirective "^\s*\([a-zA-Z0-9_]\+\)" contained nextgroup=caddySubdirectiveArgs skipwhite -syn region caddySubdirectiveArgs start="" end="\(#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString +syn match caddySubdirective "\v^\s*(\w\S*)" contained nextgroup=caddySubdirectiveArgs skipwhite +syn region caddySubdirectiveArgs start="" end="\(#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString,caddyNamedMatcher -syn match caddyHost "\(https\?:\/\/\)\?\(\(\w\{1,}\.\)\(\w\{2,}\.\?\)\+\|localhost\)\(:[0-9]\{1,5}\)\?" nextgroup=caddyHostBlock skipwhite -syn region caddyHostBlock start="{" skip="\\}" end="}" contained contains=caddyDirective,caddyComment +" Needs priority over Directive +syn match caddyImport "\v^\s*<import>" nextgroup=caddyImportPattern skipwhite +syn match caddyImportPattern "\v\c\S+" contained nextgroup=caddyImportArgs skipwhite +syn region caddyImportArgs start="" end="$"me=s-1 oneline contained contains=caddyPlaceholder,caddyString,caddyNamedMatcher + +syn match caddyHost "\v\c^\s*\zs(https?://)?(([0-9a-z-]+\.)([0-9a-z-]+\.?)+|[0-9a-z-]+)?(:\d{1,5})?" nextgroup=caddyHostBlock skipwhite +syn region caddyHostBlock start="{" skip="\\}" end="}" contained contains=caddyDirective,caddyComment,caddyNamedMatcherDef,caddyImport + +" Needs priority over Host +syn region caddySnippetDef start="("rs=e+1 end=")"re=s-1 oneline keepend contains=caddySnippet +syn match caddySnippet "\v\w+" contained nextgroup=caddySnippetBlock skipwhite + +syn match caddyNamedMatcher "\v^\s*\zs\@\S+" contained skipwhite +syn match caddyNamedMatcherDef "\v\s*\zs\@\S+" nextgroup=caddyNamedMatcherDefBlock +syn region caddyNamedMatcherDefBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment,caddyImport syn region caddyPlaceholder start="{" skip="\\}" end="}" oneline contained syn region caddyString start='"' skip='\\\\\|\\"' end='"' oneline -syn match caddyComment "#.*$" +syn region caddyComment start="#" end="$" oneline hi link caddyDirective Keyword hi link caddySubdirective Structure hi link caddyHost Identifier +hi link caddyImport PreProc +hi link caddySnippetDef PreProc +hi link caddySnippet Identifier hi link caddyPlaceholder Special hi link caddyString String hi link caddyComment Comment +hi link caddyNamedMatcherDef caddyNamedMatcher +hi link caddyNamedMatcher Identifier let b:current_syntax = "caddyfile" |