Add initial HLDS highlighting for Vim
This commit is contained in:
parent
a3af7476c7
commit
9f2edb2f81
3 changed files with 53 additions and 0 deletions
1
etc/vim/ftdetect.vim
Normal file
1
etc/vim/ftdetect.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
au BufRead,BufNewFile *.hlds set filetype=hlds
|
1
etc/vim/ftplugin.vim
Normal file
1
etc/vim/ftplugin.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
setlocal noexpandtab
|
51
etc/vim/syntax.vim
Normal file
51
etc/vim/syntax.vim
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: HLDS
|
||||||
|
" Maintainer: Zeus WPI
|
||||||
|
|
||||||
|
" quit when a syntax file was already loaded.
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" We need nocompatible mode in order to continue lines with backslashes.
|
||||||
|
" Original setting will be restored.
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
syn match hldsLocationAttribute "^\t[a-z0-9_-]\+ " display contained nextgroup=hldsLocationAttributeValue
|
||||||
|
syn match hldsLocationAttributeValue "[^\n]\+$" display contained
|
||||||
|
|
||||||
|
syn region hldsLocationHeader matchgroup=hldsLocationHeaderDelim
|
||||||
|
\ start="^====*$" end="^====*$"
|
||||||
|
\ contains=hldsLocationAttribute
|
||||||
|
|
||||||
|
syn keyword hldsBlockType base nextgroup=hldsBlockIdAftrKywrd skipwhite
|
||||||
|
syn keyword hldsChoiceType single_choice multi_choice nextgroup=hldsBlockIdAftrKywrd skipwhite
|
||||||
|
|
||||||
|
syn match hldsBlockId "^[a-z0-9_-]\+: "
|
||||||
|
syn match hldsBlockIdAftrKywrd "[a-z0-9_-]\+: " contained
|
||||||
|
|
||||||
|
syn match hldsTag " {[a-z0-9_-]\+}"
|
||||||
|
syn match hldsPrice "€ *[0-9]\+\(\.[0-9]\+\|\)"
|
||||||
|
|
||||||
|
" trailing whitespace
|
||||||
|
syn match hldsSpaceError display excludenl "\s\+$"
|
||||||
|
" spaces instead of tabs
|
||||||
|
syn match hldsSpaceError display "^\t* "
|
||||||
|
|
||||||
|
" The default highlight links. Can be overridden later.
|
||||||
|
hi def link hldsLocationHeader Function
|
||||||
|
hi def link hldsLocationHeaderDelim hldsLocationHeader
|
||||||
|
hi def link hldsLocationAttribute hldsLocationHeader
|
||||||
|
hi def link hldsChoiceType Statement
|
||||||
|
hi def link hldsBlockType Statement
|
||||||
|
hi def link hldsBlockId Include
|
||||||
|
hi def link hldsBlockIdAftrKywrd hldsBlockId
|
||||||
|
hi def link hldsPrice Number
|
||||||
|
hi def link hldsTag String
|
||||||
|
hi def link hldsSpaceError Error
|
||||||
|
|
||||||
|
let b:current_syntax = "hlds"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
Loading…
Reference in a new issue