Add raml syntax highlighting, closes #155
This commit is contained in:
parent
98e021e969
commit
9b23910103
@ -94,6 +94,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload, ftdetect)
|
||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
||||
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin, ftdetect)
|
||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
|
||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||
|
1
build
1
build
@ -166,6 +166,7 @@ PACKS="
|
||||
python-compiler:aliev/vim-compiler-python
|
||||
qml:peterhoeg/vim-qml
|
||||
r-lang:vim-scripts/R.vim
|
||||
raml:IN3D/vim-raml
|
||||
ragel:jneen/ragel.vim
|
||||
rspec:sheerun/rspec.vim
|
||||
ruby:vim-ruby/vim-ruby
|
||||
|
@ -501,3 +501,94 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
endif
|
||||
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
|
||||
syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
|
||||
syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
|
||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster
|
||||
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster
|
||||
syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster
|
||||
syntax match jsFlowNoise contained /[:;,<>]/
|
||||
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object array bool class
|
||||
syntax keyword jsFlowTypeof contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType
|
||||
syntax match jsFlowTypeCustom contained /\k*/ skipwhite skipempty nextgroup=jsFlowGroup
|
||||
syntax region jsFlowGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster
|
||||
syntax region jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/ end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster
|
||||
syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
|
||||
syntax match jsFlowMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments
|
||||
syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
|
||||
syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
|
||||
|
||||
syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster
|
||||
syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||
syntax region jsFlowReturnArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||
syntax region jsFlowReturnParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||
syntax match jsFlowReturnKeyword contained /\k\+/ contains=jsFlowType,jsFlowTypeCustom skipwhite skipempty nextgroup=jsFlowReturnGroup,jsFuncBlock,jsFlowReturnOrOp
|
||||
syntax match jsFlowReturnMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword
|
||||
syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||
syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
|
||||
|
||||
syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||
|
||||
syntax region jsFlowTypeStatement start=/type/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend
|
||||
syntax region jsFlowTypeValue contained start=/=/ end=/[;\n]/ contains=@jsExpression,jsFlowGroup,jsFlowMaybe
|
||||
syntax match jsFlowTypeOperator contained /=/
|
||||
syntax keyword jsFlowTypeKeyword contained type
|
||||
|
||||
syntax keyword jsFlowDeclare declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface
|
||||
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlowClassDef containedin=jsClassBlock
|
||||
syntax region jsFlowClassDef contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassValue
|
||||
|
||||
syntax region jsFlowModule contained start=/module/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowDeclareBlock contains=jsString
|
||||
syntax region jsFlowInterface contained start=/interface/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster
|
||||
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise
|
||||
|
||||
syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise keepend
|
||||
|
||||
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp
|
||||
syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGroup,jsFlowArrowArguments,jsFlowMaybe,jsFlowParens,jsFlowOrOperator
|
||||
|
||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
if version < 508
|
||||
let did_javascript_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
HiLink jsFlowDefinition PreProc
|
||||
HiLink jsFlowClassDef jsFlowDefinition
|
||||
HiLink jsFlowArgumentDef jsFlowDefinition
|
||||
HiLink jsFlowType Type
|
||||
HiLink jsFlowTypeCustom PreProc
|
||||
HiLink jsFlowTypeof PreProc
|
||||
HiLink jsFlowArray PreProc
|
||||
HiLink jsFlowObject PreProc
|
||||
HiLink jsFlowParens PreProc
|
||||
HiLink jsFlowGroup PreProc
|
||||
HiLink jsFlowReturn PreProc
|
||||
HiLink jsFlowReturnObject jsFlowReturn
|
||||
HiLink jsFlowReturnArray jsFlowArray
|
||||
HiLink jsFlowReturnParens jsFlowParens
|
||||
HiLink jsFlowReturnGroup jsFlowGroup
|
||||
HiLink jsFlowFunctionGroup PreProc
|
||||
HiLink jsFlowClassGroup PreProc
|
||||
HiLink jsFlowArrowArguments PreProc
|
||||
HiLink jsFlowArrow PreProc
|
||||
HiLink jsFlowTypeStatement PreProc
|
||||
HiLink jsFlowTypeKeyword PreProc
|
||||
HiLink jsFlowTypeOperator PreProc
|
||||
HiLink jsFlowMaybe PreProc
|
||||
HiLink jsFlowReturnMaybe PreProc
|
||||
HiLink jsFlowClassProperty jsClassProperty
|
||||
HiLink jsFlowDeclare PreProc
|
||||
HiLink jsFlowModule PreProc
|
||||
HiLink jsFlowInterface PreProc
|
||||
HiLink jsFlowNoise Noise
|
||||
HiLink jsFlowObjectKey jsObjectKey
|
||||
HiLink jsFlowOrOperator PreProc
|
||||
HiLink jsFlowReturnOrOp jsFlowOrOperator
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -342,3 +342,46 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
endif
|
||||
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
|
||||
"" syntax coloring for javadoc comments (HTML)
|
||||
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||
|
||||
" tags containing a param
|
||||
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||
" tags containing type and param
|
||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
||||
" tags containing type but no param
|
||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||
" tags containing references
|
||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||
" other tags (no extra syntax)
|
||||
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||
|
||||
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||
|
||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
if version < 508
|
||||
let did_javascript_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
HiLink jsDocTags Special
|
||||
HiLink jsDocSeeTag Function
|
||||
HiLink jsDocType Type
|
||||
HiLink jsDocTypeBrackets jsDocType
|
||||
HiLink jsDocTypeRecord jsDocType
|
||||
HiLink jsDocTypeNoParam Type
|
||||
HiLink jsDocParam Label
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -54,3 +54,10 @@ syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" n
|
||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
|
||||
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||
|
||||
endif
|
||||
|
@ -708,6 +708,13 @@ autocmd BufRead,BufNewFile *.qml setfiletype qml
|
||||
|
||||
endif
|
||||
|
||||
" ftdetect/raml.vim
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||
|
||||
au BufRead,BufNewFile *.raml set ft=raml
|
||||
|
||||
endif
|
||||
|
||||
" ftdetect/ruby.vim
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
||||
|
||||
|
5
ftplugin/raml.vim
Normal file
5
ftplugin/raml.vim
Normal file
@ -0,0 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||
|
||||
set ts=2 sts=2 sw=2 et
|
||||
|
||||
endif
|
108
syntax/raml.vim
Normal file
108
syntax/raml.vim
Normal file
@ -0,0 +1,108 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: RAML (RESTful API Modeling Language)
|
||||
" Maintainer: Eric Hopkins <eric.on.tech@gmail.com>
|
||||
" Last Change: 2016-02-29
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
syn keyword ramlTodo contained TODO FIXME XXX NOTE
|
||||
|
||||
syn region ramlComment display oneline start='\%(^\|\s\)#' end='$'
|
||||
\ contains=ramlTodo,@Spell
|
||||
|
||||
syn region ramlVersion display oneline start='#%RAML' end='$'
|
||||
|
||||
syn match ramlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)'
|
||||
|
||||
syn match ramlAnchor '&.\+'
|
||||
|
||||
syn match ramlAlias '\*.\+'
|
||||
|
||||
syn match ramlDelimiter '[-,:]'
|
||||
syn match ramlBlock '[\[\]{}>|]'
|
||||
syn match ramlOperator '[?+-]'
|
||||
syn match ramlKey '\h\+\(?\)\?\ze\s*:'
|
||||
syn match ramlKey '\w\+\(\s\+\w\+\)*\(?\)\?\ze\s*:'
|
||||
syn match routeKey '\/\w\+\(\s\+\w\+\)*\ze\s*:'
|
||||
syn match routeKey 'application\/\w\+\ze\s*:'
|
||||
syn match routeParamKey '\/{\w\+}*\ze\s*:'
|
||||
|
||||
syn region ramlString matchgroup=ramlStringDelimiter
|
||||
\ start=+\s"+ skip=+\\"+ end=+"+
|
||||
\ contains=ramlEscape
|
||||
syn region ramlString matchgroup=ramlStringDelimiter
|
||||
\ start=+\s'+ skip=+''+ end=+'+
|
||||
\ contains=ramlStringEscape
|
||||
syn region ramlParameter matchgroup=ramlParameterDelimiter
|
||||
\ start=+<<+ skip=+''+ end=+>>+
|
||||
syn match ramlEscape contained display +\\[\\"abefnrtv^0_ NLP]+
|
||||
syn match ramlEscape contained display '\\x\x\{2}'
|
||||
syn match ramlEscape contained display '\\u\x\{4}'
|
||||
syn match ramlEscape contained display '\\U\x\{8}'
|
||||
syn match ramlEscape display '\\\%(\r\n\|[\r\n]\)'
|
||||
syn match ramlStringEscape contained +''+
|
||||
|
||||
syn match ramlNumber display
|
||||
\ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\='
|
||||
syn match ramlNumber display '0\o\+'
|
||||
syn match ramlNumber display '0x\x\+'
|
||||
syn match ramlNumber display '([+-]\=[iI]nf)'
|
||||
syn match ramlNumber display '(NaN)'
|
||||
|
||||
syn match ramlConstant '\<[~yn]\>'
|
||||
syn keyword ramlConstant true True TRUE false False FALSE
|
||||
syn keyword ramlConstant yes Yes on ON no No off OFF
|
||||
syn keyword ramlConstant null Null NULL nil Nil NIL
|
||||
|
||||
syn keyword httpVerbs get post put delete head patch options
|
||||
syn keyword ramlTypes string number integer date boolean file
|
||||
|
||||
syn match ramlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\='
|
||||
|
||||
syn region ramlDocumentHeader start='---' end='$' contains=ramlDirective
|
||||
syn match ramlDocumentEnd '\.\.\.'
|
||||
|
||||
syn match ramlDirective contained '%[^:]\+:.\+'
|
||||
|
||||
hi def link ramlVersion String
|
||||
hi def link routeInterpolation String
|
||||
hi def link ramlInterpolation Constant
|
||||
hi def link ramlTodo Todo
|
||||
hi def link ramlComment Comment
|
||||
hi def link ramlDocumentHeader PreProc
|
||||
hi def link ramlDocumentEnd PreProc
|
||||
hi def link ramlDirective Keyword
|
||||
hi def link ramlNodeProperty Type
|
||||
hi def link ramlAnchor Type
|
||||
hi def link ramlAlias Type
|
||||
hi def link ramlBlock Operator
|
||||
hi def link ramlOperator Operator
|
||||
hi def link routeParamKey SpecialChar
|
||||
hi def link ramlKey Identifier
|
||||
hi def link routeKey SpecialChar
|
||||
hi def link ramlParameterDelimiter Type
|
||||
hi def link ramlParameter Type
|
||||
hi def link ramlString String
|
||||
hi def link ramlStringDelimiter ramlString
|
||||
hi def link ramlEscape SpecialChar
|
||||
hi def link ramlStringEscape SpecialChar
|
||||
hi def link ramlNumber Number
|
||||
hi def link ramlConstant Constant
|
||||
hi def link ramlTimestamp Number
|
||||
hi def link httpVerbs Statement
|
||||
hi def link ramlTypes Type
|
||||
hi def link ramlDelimiter Delimiter
|
||||
|
||||
let b:current_syntax = "raml"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
endif
|
Loading…
x
Reference in New Issue
Block a user