Skip to content

Commit be3191a

Browse files
authored
Merge pull request #871 from nickrolfe/vim
Vim syntax highlighting and file-type detection
2 parents 52ad816 + 7db2f64 commit be3191a

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

misc/vim/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# QL syntax highlighting and file-type detection for Vim
2+
3+
To install, copy the `syntax` and `ftdetect` directories to `~/.vim`.

misc/vim/ftdetect/ql.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
au BufRead,BufNewFile *.ql setfiletype ql
3+
au BufRead,BufNewFile *.qll setfiletype ql
4+

misc/vim/syntax/ql.vim

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
syn keyword qlKeyword from where select predicate in as order by asc desc module result this super
2+
syn keyword qlAnnotation abstract cached external final library noopt private deprecated override query pragma language bindingset noinline nomagic monotonicAggregates
3+
syn keyword qlLogic not and or implies exists forall forex any none
4+
syn keyword qlConditional if then else
5+
syn keyword qlType int float string boolean date
6+
syn keyword qlImport import nextgroup=qlQualified skipwhite
7+
syn keyword qlTypeMod class extends instanceof nextgroup=qlType skipwhite
8+
syn keyword qlAggregate avg concat count max min rank strictconcat strictcount strictsum sum
9+
syn keyword qlConstant false true
10+
11+
syn match qlQualified "\v([a-zA-Z_]+\.)*[a-zA-Z_]+"
12+
syn match qlComment "//.*$" contains=@Spell
13+
syn match qlComparison "[!=<>]"
14+
syn match qlVar "\v[a-zA-Z0-9_#]+"
15+
syn match qlType "\v[@A-Z][a-zA-Z0-9_]+"
16+
syn match qlPredicate "\v[a-zA-Z0-9_#@]+\ze\("
17+
syn match qlInt "\d\+"
18+
syn match qlFloat "\d\+\.\d\+"
19+
20+
syn region qlComment start="/\*" end="\*/" contains=@Spell
21+
syn region qlString start=/\v"/ skip=/\v\\./ end=/\v"/
22+
23+
hi def link qlComment Comment
24+
hi def link qlString String
25+
hi def link qlImport Include
26+
hi def link qlComparison Operator
27+
hi def link qlAnnotation PreProc
28+
hi def link qlTypeMod Keyword
29+
hi def link qlLogic Keyword
30+
hi def link qlAggregate Keyword
31+
hi def link qlPredicate Function
32+
hi def link qlConditional Conditional
33+
hi def link qlType Type
34+
hi def link qlConstant Constant
35+
hi def link qlInt Number
36+
hi def link qlFloat Float
37+
if !exists("g:qlVarNoHighlight")
38+
hi def link qlVar Identifier
39+
endif
40+
hi def link qlKeyword Keyword
41+
hi def link qlQualified Normal
42+

0 commit comments

Comments
 (0)