diff --git a/syntax/go.vim b/syntax/go.vim index f575b55a84..484b400bef 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -81,6 +81,10 @@ if !exists("g:go_highlight_string_spellcheck") let g:go_highlight_string_spellcheck = 1 endif +if !exists("g:go_highlight_generate_tags") + let g:go_highlight_generate_tags = 0 +endif + syn case match syn keyword goDirective package import @@ -132,11 +136,18 @@ hi def link goBoolean Boolean syn keyword goTodo contained TODO FIXME XXX BUG syn cluster goCommentGroup contains=goTodo syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell -syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell +syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell hi def link goComment Comment hi def link goTodo Todo +if g:go_highlight_generate_tags != 0 + syn match goGenerateVariables contained /\(\$GOARCH\|\$GOOS\|\$GOFILE\|\$GOLINE\|\$GOPACKAGE\|\$DOLLAR\)\>/ + syn region goGenerate start="^\s*//go:generate" end="$" contains=goGenerateVariables + hi def link goGenerate PreProc + hi def link goGenerateVariables Special +endif + " Go escapes syn match goEscapeOctal display contained "\\[0-7]\{3}" syn match goEscapeC display contained +\\[abfnrtv\\'"]+