Add velocity templates support
This commit is contained in:
parent
d8eaa50aed
commit
1a97304cf6
@ -26,7 +26,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
## Language packs
|
## Language packs
|
||||||
|
|
||||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
|
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
|
||||||
- [blade](https://github.com/xsbeats/vim-blade) (syntax, indent, ftdetect)
|
- [blade](https://github.com/xsbeats/vim-blade) (syntax, ftdetect)
|
||||||
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
||||||
- [c/c++](https://github.com/vim-jp/cpp-vim) (syntax)
|
- [c/c++](https://github.com/vim-jp/cpp-vim) (syntax)
|
||||||
- [c-extensions](https://github.com/kergoth/aftersyntaxc.vim) (syntax)
|
- [c-extensions](https://github.com/kergoth/aftersyntaxc.vim) (syntax)
|
||||||
@ -82,11 +82,12 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, compiler, ftplugin, ftdetect)
|
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, compiler, ftplugin, ftdetect)
|
||||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
||||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftdetect)
|
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
||||||
- [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect)
|
- [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect)
|
||||||
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||||
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect)
|
|
||||||
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
||||||
|
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect)
|
||||||
|
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent, ftdetect)
|
||||||
- [css-color](https://github.com/ap/vim-css-color) (autoload, syntax)
|
- [css-color](https://github.com/ap/vim-css-color) (autoload, syntax)
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
1
build
1
build
@ -132,6 +132,7 @@ PACKS="
|
|||||||
xls:vim-scripts/XSLT-syntax
|
xls:vim-scripts/XSLT-syntax
|
||||||
yard:sheerun/vim-yardoc
|
yard:sheerun/vim-yardoc
|
||||||
vala:tkztmk/vim-vala
|
vala:tkztmk/vim-vala
|
||||||
|
vm:lepture/vim-velocity
|
||||||
css-color:ap/vim-css-color
|
css-color:ap/vim-css-color
|
||||||
"
|
"
|
||||||
|
|
||||||
|
@ -207,3 +207,4 @@ autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
|||||||
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
||||||
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
|
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
|
||||||
au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
|
au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
|
||||||
|
au BufRead,BufNewFile *.vm set ft=velocity syntax=velocity
|
||||||
|
5
indent/velocity.vim
Normal file
5
indent/velocity.vim
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! indent/html.vim
|
67
syntax/velocity.vim
Normal file
67
syntax/velocity.vim
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Velocity HTML template
|
||||||
|
" Maintainer: Hsiaoming Young <http://lepture.com>
|
||||||
|
" Last Change: 2012 Jan 09
|
||||||
|
|
||||||
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("main_syntax")
|
||||||
|
let main_syntax = 'html'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
so <sfile>:p:h/html.vim
|
||||||
|
else
|
||||||
|
runtime! syntax/html.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn keyword velocityTodo FIXME TODO contained
|
||||||
|
syn region velocitySpec start="@" end=" " oneline contained
|
||||||
|
syn region velocityComment start="#\*" end="\*#" contains=velocityTodo,velocitySpec
|
||||||
|
syn match velocityComment /##.*/ contains=velocityTodo,velocitySpec
|
||||||
|
syn region velocityString start='"' end='"' oneline display
|
||||||
|
syn region velocityString start="'" end="'" oneline display
|
||||||
|
syn match velocityNumber "[-+]\=\d\+\(\.\d*\)\=" display
|
||||||
|
syn region velocityList start='\[' end='\]' oneline contained contains=velocityString,velocityNumber
|
||||||
|
syn match velocityMath /=\|-\|+\|\/\|\*\|%/ contained
|
||||||
|
syn match velocityBlock /#[a-z]\{2,\}/ contains=velocityStatement
|
||||||
|
syn match velocityBlock /#[a-z]\{2,\}(.\+)/ contains=velocityStatement,velocityVar,velocityString,velocityNumber,velocityMath,velocityList
|
||||||
|
syn keyword velocityStatement in set if else elseif end foreach include parse macro cmsparse stop break evaluate define contained
|
||||||
|
|
||||||
|
syn match velocityVar /$!\?[a-zA-Z][a-zA-Z0-9_-]\+\(\.\?[a-zA-Z0-9]*\)\+/ contains=velocityFunction display containedin=ALL
|
||||||
|
syn match velocityVar /$!\?{[a-zA-Z][a-zA-Z0-9_-]\+}/ display containedin=ALL
|
||||||
|
syn match velocityFunction /[a-zA-Z][a-zA-Z0-9_-]\+\(\.[a-zA-Z][a-zA-Z0-9_-]\+\)\+([^)]*)/ contains=velocityString,velocityNumber,velocityList,velocityMath,velocityVar,velocityFunction display containedin=velocityBlock
|
||||||
|
|
||||||
|
" Define the default highlighting.
|
||||||
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||||
|
if version >= 508 || !exists("did_velocity_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_velocity_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink velocityString String
|
||||||
|
HiLink velocityNumber Number
|
||||||
|
HiLink velocityList Constant
|
||||||
|
HiLink velocityBlock PreProc
|
||||||
|
HiLink velocitySpec Special
|
||||||
|
HiLink velocityVar Identifier
|
||||||
|
HiLink velocityFunction Function
|
||||||
|
HiLink velocityStatement Statement
|
||||||
|
HiLink velocityComment Comment
|
||||||
|
HiLink velocityTodo Todo
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "velocity"
|
Loading…
x
Reference in New Issue
Block a user