Skip to content

Commit

Permalink
Merge pull request #757 from mhamrle/generate
Browse files Browse the repository at this point in the history
syntax highlighting for //go:generate
  • Loading branch information
fatih committed Mar 16, 2016
2 parents 1c581cb + 0bd3f9a commit 6e1072e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion syntax/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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\\'"]+
Expand Down

0 comments on commit 6e1072e

Please sign in to comment.