Skip to content

Commit

Permalink
syntax/go: do not treat builtins as keywords
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mmlb committed Nov 17, 2015
1 parent 6384e3a commit d52c164
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions syntax/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ syn match goDeclaration /\<func\>/


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

hi def link goBuiltins Keyword
Expand Down

0 comments on commit d52c164

Please sign in to comment.