Skip to content

Commit

Permalink
Merge pull request #681 from StabbyCutyou/feature/highlight_interfaces
Browse files Browse the repository at this point in the history
Adding in go_highlight_interfaces option, to provide the same highlig…
  • Loading branch information
fatih committed Jan 18, 2016
2 parents 7708bce + 07b6b38 commit ee5b7c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
6 changes: 6 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'*

Expand Down
12 changes: 12 additions & 0 deletions syntax/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit ee5b7c0

Please sign in to comment.