Add api blueprint support, closes #182
This commit is contained in:
parent
c2a7f363c6
commit
ef4435cffc
@ -37,6 +37,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
## Language packs
|
||||
|
||||
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin)
|
||||
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim) (syntax)
|
||||
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
|
||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent)
|
||||
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin)
|
||||
|
1
build
1
build
@ -104,6 +104,7 @@ EOF
|
||||
}
|
||||
|
||||
PACKS="
|
||||
apiblueprint:sheerun/apiblueprint.vim
|
||||
applescript:vim-scripts/applescript.vim
|
||||
yaml:stephpy/vim-yaml
|
||||
ansible:pearofducks/ansible-vim
|
||||
|
@ -1,3 +1,10 @@
|
||||
augroup filetypedetect
|
||||
" apiblueprint:sheerun/apiblueprint.vim
|
||||
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
|
||||
autocmd FileType apiblueprint set syntax=apiblueprint
|
||||
autocmd FileType apiblueprint set makeprg=drafter\ -l\ %
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" applescript:vim-scripts/applescript.vim
|
||||
augroup END
|
||||
|
38
syntax/apiblueprint.vim
Normal file
38
syntax/apiblueprint.vim
Normal file
@ -0,0 +1,38 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'apiblueprint') == -1
|
||||
|
||||
runtime! syntax/markdown.vim
|
||||
unlet! b:current_syntax
|
||||
|
||||
" Metadata
|
||||
syntax region apibMarkdownMetadata start=/\%^.*:.*$/ end=/^$/ contains=apibMarkdownMetadataKey,apibMarkdownMetadataValue fold
|
||||
syntax match apibMarkdownMetadataKey /^[^:]*\ze:/ contained
|
||||
syntax match apibMarkdownMetadataValue /:.*/ contained
|
||||
|
||||
syntax region apibHTTPStatusCode start=/\d\d\d/ end=// contained containedin=apibResponseSection
|
||||
syntax region apibHTTPContentType start=/(.*)/ end=// contained containedin=apibResponseSection
|
||||
|
||||
syntax region apibModelSection start=/^+ Model/ end=/$/ oneline
|
||||
syntax region apibRequestSection start=/^[-+*] Request.*/ end=/^$/ contains=apibHTTPContentType
|
||||
syntax region apibResponseSection start=/^[-+*] Response \d\d\d/ end=/^$/ contains=apibHTTPStatusCode,apibHTTPContentType
|
||||
syntax region apibHeadersSection start=/^+ Headers$/ end=/^\S.*$/ contains=apibHeadersSectionKey,apibHeadersSectionValue
|
||||
|
||||
syntax region apibActionRelationKey start=/: .*/ end=/$/ contained
|
||||
syntax region apibActionRelation start=/^[-+*] Relation: .*$/ end=/$/ oneline contains=apibActionRelationKey
|
||||
|
||||
syntax match apibHeadersSectionKey /^[^:]*\ze:/ contained
|
||||
syntax match apibHeadersSectionValue /:.*/ contained
|
||||
|
||||
highlight default link apibMarkdownMetadataKey Function
|
||||
highlight default link apibRequestSection Function
|
||||
highlight default link apibResponseSection Function
|
||||
highlight default link apibModelSection Function
|
||||
highlight default link apibHeadersSectionKey Function
|
||||
highlight default link apibHTTPStatusCode Delimiter
|
||||
highlight default link apibHTTPContentType Comment
|
||||
highlight default link apibActionRelation Function
|
||||
highlight default link apibActionRelationKey Identifier
|
||||
|
||||
let b:current_syntax = 'apiblueprint'
|
||||
|
||||
|
||||
endif
|
Loading…
Reference in New Issue
Block a user