diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2017-03-23 11:43:41 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2017-03-23 11:43:41 +0100 |
commit | 461de4cc216cac858ccc4f2dd99644e6ea43589d (patch) | |
tree | 4ea2373904a594c143b029d279218f9650b6833c /syntax | |
parent | ba758909360bbd037cea06fd4e4eec8da7bf8751 (diff) | |
download | vim-polyglot-461de4cc216cac858ccc4f2dd99644e6ea43589d.tar.gz vim-polyglot-461de4cc216cac858ccc4f2dd99644e6ea43589d.zip |
Add caddyfile support, closes #195
Diffstat (limited to 'syntax')
-rw-r--r-- | syntax/caddyfile.vim | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/syntax/caddyfile.vim b/syntax/caddyfile.vim new file mode 100644 index 00000000..17d95658 --- /dev/null +++ b/syntax/caddyfile.vim @@ -0,0 +1,33 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'caddyfile') == -1 + +" Language: Caddyfile +" Author: Josh Glendenning <josh@isobit.io> + +if exists("b:current_syntax") + finish +endif + +syn match caddyDirective "^\s*\([a-z]\+\)" 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 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 caddyHost "\(https\?:\/\/\)\?\(\(\w\{1,}\.\)\(\w\{2,}\.\?\)\+\|localhost\)\(:[0-9]\{1,5}\)\?" nextgroup=caddyHostBlock skipwhite +syn region caddyHostBlock start="{" skip="\\}" end="}" contained contains=caddyDirective,caddyComment + +syn region caddyPlaceholder start="{" skip="\\}" end="}" oneline contained +syn region caddyString start='"' skip='\\\\\|\\"' end='"' oneline +syn match caddyComment "#.*$" + +hi link caddyDirective Keyword +hi link caddySubdirective Structure +hi link caddyHost Identifier +hi link caddyPlaceholder Special +hi link caddyString String +hi link caddyComment Comment + +let b:current_syntax = "caddyfile" + +endif |