Add basic syntax files

- Set the filetype to "vue" for files with a .vue extension
 - Define regions for <template>, <style>, and <script> tags
 - Include HTML, CSS, and JavaScript syntax highlighting for the <template>,
   <style>, and <script> regions
This commit is contained in:
W. Evan Sheehan
2015-02-21 16:57:56 -05:00
parent 739d131fa3
commit 33ca5940c5
3 changed files with 24 additions and 0 deletions

2
README.md Normal file
View File

@@ -0,0 +1,2 @@
Vim syntax highlighting for [Vue
components](http://vuejs.org/guide/application.html#Single_File_Components).

1
ftdetect/vue.vim Normal file
View File

@@ -0,0 +1 @@
au BufNewFile,BufRead *.vue setf vue

21
syntax/vue.vim Normal file
View File

@@ -0,0 +1,21 @@
" Vim syntax file
" Language: Vue.js
" Maintainer: W. Evan Sheehan
if exists("b:current_syntax")
finish
endif
syntax include @HTML syntax/html.vim
unlet b:current_syntax
syntax region template keepend start=/<template\( lang="[a-zA-Z]\+"\)\?>/ end="</template>" contains=@HTML fold
syntax include @JS syntax/javascript.vim
unlet b:current_syntax
syntax region script keepend start=/<script\( lang="[a-zA-Z]\+"\)\?>/ end="</script>" contains=@JS fold
syntax include @CSS syntax/css.vim
unlet b:current_syntax
syntax region style keepend start=/<style\( lang="[a-zA-Z]\+"\)\?>/ end="</style>" contains=@CSS fold
let b:current_syntax = "vue"