Skip to content

Commit fa07364

Browse files
committed
Vim syntax highlighting and file-type detection
1 parent 6243c72 commit fa07364

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
syn keyword qlKeyword from where select predicate in as order by asc desc module
2+
syn keyword qlAnnotation abstract cached external final library noopt private
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 qlPredicate rank
9+
10+
syn match qlQualified "\v([a-zA-Z_]+\.)*[a-zA-Z_]+"
11+
syn match qlComment "//.*$" contains=@Spell
12+
syn match qlComparison "[!=<>]"
13+
syn match qlVar "\v[a-zA-Z0-9_#]+"
14+
syn match qlType "\v[@A-Z][a-zA-Z0-9_]+"
15+
syn match qlPredicate "\v[a-zA-Z0-9_#@]+\ze\("
16+
17+
syn region qlComment start="/\*" end="\*/" contains=@Spell
18+
syn region qlString start=/\v"/ skip=/\v\\./ end=/\v"/
19+
20+
hi def link qlComment Comment
21+
hi def link qlString String
22+
hi def link qlImport Include
23+
hi def link qlComparison Operator
24+
hi def link qlAnnotation PreProc
25+
hi def link qlTypeMod Keyword
26+
hi def link qlLogic Keyword
27+
hi def link qlPredicate Function
28+
hi def link qlConditional Conditional
29+
hi def link qlType Type
30+
if !exists("g:qlVarNoHighlight")
31+
hi def link qlVar Identifier
32+
endif
33+
hi def link qlKeyword Keyword
34+
hi def link qlQualified Normal
35+

0 commit comments

Comments
 (0)