Vim syntax highlighting and file-type detection

This commit is contained in:
Nick Rolfe
2019-02-04 10:48:32 +00:00
parent 6243c722c6
commit fa07364214
3 changed files with 42 additions and 0 deletions

3
misc/vim/README.md Normal file
View File

@@ -0,0 +1,3 @@
# QL syntax highlighting and file-type detection for Vim
To install, copy the `syntax` and `ftdetect` directories to `~/.vim`.

4
misc/vim/ftdetect/ql.vim Normal file
View File

@@ -0,0 +1,4 @@
au BufRead,BufNewFile *.ql setfiletype ql
au BufRead,BufNewFile *.qll setfiletype ql

35
misc/vim/syntax/ql.vim Normal file
View File

@@ -0,0 +1,35 @@
syn keyword qlKeyword from where select predicate in as order by asc desc module
syn keyword qlAnnotation abstract cached external final library noopt private
syn keyword qlLogic not and or implies exists forall forex any none
syn keyword qlConditional if then else
syn keyword qlType int float string boolean date
syn keyword qlImport import nextgroup=qlQualified skipwhite
syn keyword qlTypeMod class extends instanceof nextgroup=qlType skipwhite
syn keyword qlPredicate rank
syn match qlQualified "\v([a-zA-Z_]+\.)*[a-zA-Z_]+"
syn match qlComment "//.*$" contains=@Spell
syn match qlComparison "[!=<>]"
syn match qlVar "\v[a-zA-Z0-9_#]+"
syn match qlType "\v[@A-Z][a-zA-Z0-9_]+"
syn match qlPredicate "\v[a-zA-Z0-9_#@]+\ze\("
syn region qlComment start="/\*" end="\*/" contains=@Spell
syn region qlString start=/\v"/ skip=/\v\\./ end=/\v"/
hi def link qlComment Comment
hi def link qlString String
hi def link qlImport Include
hi def link qlComparison Operator
hi def link qlAnnotation PreProc
hi def link qlTypeMod Keyword
hi def link qlLogic Keyword
hi def link qlPredicate Function
hi def link qlConditional Conditional
hi def link qlType Type
if !exists("g:qlVarNoHighlight")
hi def link qlVar Identifier
endif
hi def link qlKeyword Keyword
hi def link qlQualified Normal