Skip to content

Commit fd510cd

Browse files
committed
Add goto statement highlighting
1 parent 449e94f commit fd510cd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Added
66

7+
- Add `goto` statement highlighting
78
- Add folding for interface and declaration blocks
89
- Add support for embedded generic types in structs
910
- Caveat: The type parameters cannot be spread across multiple lines

syntax/go.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,12 @@ call s:HiConfig('goFuncCallParens', ['go_highlight_function_call_parens'])
696696

697697
" Flow Control {{{
698698

699-
syntax cluster goFlowControl contains=goIf,goElse,goFor,goForRange,goForKeywords,goSwitch,goCase,goSelect,goSwitchKeywords
699+
syntax cluster goFlowControl contains=goGoto,goIf,goElse,goFor,goForRange,goForKeywords,goSwitch,goCase,goSelect,goSwitchKeywords
700700

701701
" 'goStatementStart' is used to avoid searching for 'goLabel' everywhere
702702
syntax match goLabel /\K\k*\ze:/ contained
703+
syntax keyword goGoto goto contained skipwhite nextgroup=goGotoLabel
704+
syntax match goGotoLabel /\K\k*/ contained
703705

704706
syntax keyword goIf if contained skipwhite skipempty nextgroup=goShortVarDecl
705707
syntax keyword goElse else contained
@@ -719,6 +721,9 @@ syntax region goSwitchTypeBlock matchgroup=goSwitchTypeBraces start='{' end='}'
719721
" goSwitchTypeBlockNestedBraces prevents goSwitchTypeCase from matching "case" in a regular nested switch statement
720722
syntax region goSwitchTypeBlockNestedBraces matchgroup=goBraces start='{' end='}' contained contains=@goStatement
721723

724+
hi link goGoto Statement
725+
hi link goGotoLabel goLabel
726+
722727
hi link goIf Conditional
723728
hi link goElse goIf
724729

0 commit comments

Comments
 (0)