diff --git a/README.md b/README.md index 6b96d3abd5..69ffedda90 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ To change it: let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_structs = 1 +let g:go_highlight_interfaces = 1 let g:go_highlight_operators = 1 let g:go_highlight_build_constraints = 1 ``` diff --git a/doc/vim-go.txt b/doc/vim-go.txt index 9764968a3b..6462025c4c 100755 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -840,6 +840,12 @@ Highlights method names. By default it's disabled. > Highlights struct names. By default it's disabled. > let g:go_highlight_structs = 0 +< + *'g:go_highlight_interfaces'* + +Highlights interface names. By default it's disabled. > + + let g:go_highlight_interfaces = 0 < *'g:go_highlight_build_constraints'* diff --git a/syntax/go.vim b/syntax/go.vim index e4ecaf0851..baafa481a4 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -69,6 +69,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 @@ -291,6 +295,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"