Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding in go_highlight_interfaces option, to provide the same highlig… #681

Merged
merged 2 commits into from
Jan 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,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 @@ -832,6 +832,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