mirror of
https://github.com/posva/vim-vue.git
synced 2025-12-08 10:24:45 +08:00
Fixes #8 Alse see https://github.com/pugjs/jade/issues/2184 You should now replace your jade loaders by the pug loaders and also the digitaltoad/vim-jade by digitaltoad/vim-pug which is the new vim syntax plugin for pug (mantained by the same person)
76 lines
2.2 KiB
VimL
76 lines
2.2 KiB
VimL
" Vim syntax file
|
|
" Language: Vue.js
|
|
" Maintainer: Eduardo San Martin Morote
|
|
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
if !exists("s:syntaxes")
|
|
" Search available syntax files.
|
|
function s:search_syntaxes(...)
|
|
let syntaxes = {}
|
|
let names = a:000
|
|
for name in names
|
|
let syntaxes[name] = 0
|
|
endfor
|
|
|
|
for path in split(&runtimepath, ',')
|
|
if isdirectory(path . '/syntax')
|
|
for name in names
|
|
let syntaxes[name] = syntaxes[name] || filereadable(path . '/syntax/' . name . '.vim')
|
|
endfor
|
|
endif
|
|
endfor
|
|
return syntaxes
|
|
endfunction
|
|
|
|
let s:syntaxes = s:search_syntaxes('pug', 'coffee', 'stylus', 'sass', 'less')
|
|
endif
|
|
|
|
|
|
syntax include @HTML syntax/html.vim
|
|
unlet b:current_syntax
|
|
syntax region template keepend start=/^<template>/ end=/^<\/template>/ contains=@HTML fold
|
|
|
|
if s:syntaxes.pug
|
|
syntax include @PUG syntax/pug.vim
|
|
unlet b:current_syntax
|
|
syntax region pug keepend start=/<template lang="[^"]*pug[^"]*">/ end="</template>" contains=@PUG fold
|
|
endif
|
|
|
|
syntax include @JS syntax/javascript.vim
|
|
unlet b:current_syntax
|
|
syntax region script keepend start=/<script>/ end="</script>" contains=@JS fold
|
|
|
|
if s:syntaxes.coffee
|
|
syntax include @COFFEE syntax/coffee.vim
|
|
unlet b:current_syntax
|
|
" Matchgroup seems to be necessary for coffee
|
|
syntax region coffee keepend matchgroup=Delimiter start="<script lang=\"coffee\">" end="</script>" contains=@COFFEE fold
|
|
endif
|
|
|
|
syntax include @CSS syntax/css.vim
|
|
unlet b:current_syntax
|
|
syntax region style keepend start=/<style\( \+scoped\)\?>/ end="</style>" contains=@CSS fold
|
|
|
|
if s:syntaxes.stylus
|
|
syntax include @stylus syntax/stylus.vim
|
|
unlet b:current_syntax
|
|
syntax region stylus keepend start=/<style lang="[^"]*stylus[^"]*"\( \+scoped\)\?>/ end="</style>" contains=@stylus fold
|
|
endif
|
|
|
|
if s:syntaxes.sass
|
|
syntax include @sass syntax/sass.vim
|
|
unlet b:current_syntax
|
|
syntax region sass keepend start=/<style\( \+scoped\)\? lang="[^"]*sass[^"]*"\( \+scoped\)\?>/ end="</style>" contains=@sass fold
|
|
endif
|
|
|
|
if s:syntaxes.less
|
|
syntax include @less syntax/less.vim
|
|
unlet b:current_syntax
|
|
syntax region less keepend matchgroup=PreProc start=/<style\%( \+scoped\)\? lang="less"\%( \+scoped\)\?>/ end="</style>" contains=@less fold
|
|
endif
|
|
|
|
let b:current_syntax = "vue"
|