diff options
Diffstat (limited to 'syntax/go.vim')
-rw-r--r-- | syntax/go.vim | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/syntax/go.vim b/syntax/go.vim index 4cd53c45..a0a86e83 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -71,6 +71,10 @@ if !exists("g:go_highlight_structs") let g:go_highlight_structs = 0 endif +if !exists("g:go_highlight_interfaces") + let g:go_highlight_interfaces = 0 +endif + if !exists("g:go_highlight_build_constraints") let g:go_highlight_build_constraints = 0 endif @@ -210,9 +214,17 @@ endif " Spacing errors around the 'chan' keyword if g:go_highlight_chan_whitespace_error != 0 " receive-only annotation on chan type - syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@=" + " + " \(\<chan\>\)\@<!<- (only pick arrow when it doesn't come after a chan) + " this prevents picking up 'chan<- chan<-' but not '<- chan' + syn match goSpaceError display "\(\(\<chan\>\)\@<!<-\)\@<=\s\+\(\<chan\>\)\@=" + " send-only annotation on chan type - syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@=" + " + " \(<-\)\@<!\<chan\> (only pick chan when it doesn't come after an arrow) + " this prevents picking up '<-chan <-chan' but not 'chan <-' + syn match goSpaceError display "\(\(<-\)\@<!\<chan\>\)\@<=\s\+\(<-\)\@=" + " value-ignoring receives in a few contexts syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+" endif @@ -285,6 +297,14 @@ endif hi def link goStruct Function hi def link goStructDef Function +" Interfaces; +if g:go_highlight_interfaces != 0 + syn match goInterface /\(.\)\@<=\w\+\({\)\@=/ + syn match goInterfaceDef /\(type\s\+\)\@<=\w\+\(\s\+interface\s\+{\)\@=/ +endif +hi def link goInterface Function +hi def link goInterfaceDef Function + " Build Constraints if g:go_highlight_build_constraints != 0 syn match goBuildKeyword display contained "+build" |