66call gopher#init#config ()
77let s: has = { n - > index (g: gopher_highlight , l: n ) > -1 }
88
9- " Match case.
10- syn case match
11-
12- " Search backwards for a global declaration to start processing the syntax.
13- syn sync match goSync grouphere NONE / \v ^%(const|var|type|func)>/
14-
15- " Still keep 'minlines' here since otherwise it tends to break with multiline
16- " comment blocks and `-strings where the opening is beyond the screen:
9+ " Sync from start; I can't get match to work; for example with:
10+ "
11+ " syn sync match goSync grouphere NONE /\v^%(const|var|type|func)>/
12+ "
13+ " Breaks highlights with multiline comment blocks and `-strings where the
14+ " opening is beyond the screen:
1715"
1816" const x = `
1917" [.. many lines ..]
@@ -27,8 +25,12 @@ syn sync match goSync grouphere NONE /\v^%(const|var|type|func)>/
2725" It will sync to ^func, the opening ` is out of the screen and sees just the
2826" closing, so everything is highlighted as a string.
2927"
30- " I'm not sure if there's a better solution for this.
31- syn sync minlines =500
28+ " I'm not sure if there's a better solution for this. But the highlight file
29+ " should be fast enough to just sync from start.
30+ syn sync fromstart
31+
32+ " Match case.
33+ syn case match
3234
3335" Keywords.
3436syn keyword goPackage package
@@ -43,24 +45,6 @@ syn keyword goLabel case default
4345syn keyword goRepeat for range
4446syn keyword goBoolean true false nil iota
4547
46- " Ensure these are highlighted when (erroneously) used as identifiers; this
47- " won't happen otherwise because they're contained above.
48- "
49- " They're highlighted as an error, since they're reserved words. The error
50- " highlighting isn't 100% consistent like this (i.e. not everything that's an
51- " error is highlighted as such), but that's okay.
52- "
53- " This can't be a keywords since that will take higher priority over the
54- " match/range below; using it like this is a lot faster than \<\%(..|..\)
55- " (.015 vs .007 for all 5)
56- "
57- " TODO: I don't like how this highlights 'var ' when typing regular code.
58- " syn match goReserved /\<import\>/
59- " syn match goReserved /\<package\>/
60- " syn match goReserved /\<var\>/
61- " syn match goReserved /\<const\>/
62- " syn match goReserved /\<struct\>/
63-
6448" Predefined types.
6549syn keyword goType chan map bool string error float32 float64 complex64 complex128
6650syn keyword goType int int8 int16 int32 int64 rune byte uint uint8 uint16 uint32 uint64 uintptr
0 commit comments