Skip to content

Commit d52c164

Browse files
committed
syntax/go: do not treat builtins as keywords
builtins have a very different property from keywords, the identifiers are settable. It is perfectly valid to override the builtins, though hopefully used sparingly. Instead of using `syn keyword`, we now use `syn match` and detect a function call by searching for an open parentheses.
1 parent 6384e3a commit d52c164

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

syntax/go.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ syn match goDeclaration /\<func\>/
117117

118118

119119
" Predefined functions and values
120-
syn keyword goBuiltins append cap close complex copy delete imag len
121-
syn keyword goBuiltins make new panic print println real recover
120+
syn match goBuiltins /\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
121+
syn match goBuiltins /\v(make|new|panic|print|println|real|recover)\ze\(/
122122
syn keyword goBoolean iota true false nil
123123

124124
hi def link goBuiltins Keyword

0 commit comments

Comments
 (0)