"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Vim syntax file " " Language: Vue " Maintainer: leaf " " CREDITS: Inspired by mxw/vim-jsx. " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if exists("b:current_syntax") && b:current_syntax == 'vue' finish endif " For advanced users, this variable can be used to avoid overload let b:current_loading_main_syntax = 'vue' """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Config {{{ " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let s:use_pug = vue#GetConfig("use_pug", 0) let s:use_less = vue#GetConfig("use_less", 0) let s:use_sass = vue#GetConfig("use_sass", 0) let s:use_scss = vue#GetConfig("use_scss", 0) let s:use_stylus = vue#GetConfig("use_stylus", 0) let s:use_coffee = vue#GetConfig("use_coffee", 0) let s:use_typescript = vue#GetConfig("use_typescript", 0) "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Load main syntax {{{ " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Load syntax/html.vim to syntax group, which loads full JavaScript and CSS " syntax. It defines group @html, @htmlJavaScript, and @htmlCss. call vue#LoadSyntax('@html', 'html') " Avoid overload if !hlexists('cssTagName') call vue#LoadSyntax('@htmlCss', 'css') endif " Avoid overload if !hlexists('javaScriptComment') call vue#Log('load javascript cluster') call vue#LoadSyntax('@htmlJavaScript', 'javascript') endif " Load vue-html syntax runtime syntax/vue-html.vim " Load vue-javascript syntax runtime syntax/vue-javascript.vim "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Load pre-processors syntax {{{ " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " If pug is enabled, load vim-pug syntax if s:use_pug call vue#LoadFullSyntax('@PugSyntax', 'pug') syn cluster htmlJavascript remove=javascriptParenthesisBlock endif " If less is enabled, load less syntax if s:use_less call vue#LoadSyntax('@LessSyntax', 'less') runtime! after/syntax/less.vim endif " If sass is enabled, load sass syntax if s:use_sass call vue#LoadSyntax('@SassSyntax', 'sass') runtime! after/syntax/sass.vim endif " If scss is enabled, load sass syntax if s:use_scss call vue#LoadSyntax('@ScssSyntax', 'scss') runtime! after/syntax/scss.vim endif " If stylus is enabled, load stylus syntax if s:use_stylus call vue#LoadFullSyntax('@StylusSyntax', 'stylus') runtime! after/syntax/stylus.vim endif " If CoffeeScript is enabled, load the syntax. Keep name consistent with " vim-coffee-script/after/html.vim if s:use_coffee call vue#LoadFullSyntax('@htmlCoffeeScript', 'coffee') endif " If TypeScript is enabled, load the syntax. if s:use_typescript call vue#LoadFullSyntax('@TypeScript', 'typescript') endif "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Syntax highlight {{{ " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " All start with html/javascript/css for emmet-vim in-file type detection syntax region htmlVueTemplate fold \ start=+]*>+ \ end=+^+ \ keepend contains=@html " When template code is not well indented syntax region htmlVueTemplate fold \ start=+]*>+ \ end=+\ze\n\(^$\n\)*<\(script\|style\)+ \ keepend contains=@html syntax region javascriptVueScript fold \ start=+]*>+ \ end=++ \ keepend contains=@htmlJavaScript,jsImport,jsExport,vueTag syntax region cssVueStyle fold \ start=+]*>+ \ end=++ \ keepend contains=@htmlCss,vueTag " Preprocessors syntax syntax region pugVueTemplate fold \ start=+]*lang=["']pug["'][^>]*>+ \ end=++ \ keepend contains=@PugSyntax,vueTag syntax region coffeeVueScript fold \ start=+]*lang=["']coffee["'][^>]*>+ \ end=++ \ keepend contains=@htmlCoffeeScript,jsImport,jsExport,vueTag syntax region typescriptVueScript fold \ start=+]*lang=["']ts["'][^>]*>+ \ end=++ \ keepend contains=@TypeScript,vueTag syntax region cssLessVueStyle fold \ start=+]*lang=["']less["'][^>]*>+ \ end=++ \ keepend contains=@LessSyntax,vueTag syntax region sassVueStyle fold \ start=+]*lang=["']sass["'][^>]*>+ \ end=++ \ keepend contains=@SassSyntax,vueTag syntax region cssScssVueStyle fold \ start=+]*lang=["']scss["'][^>]*>+ \ end=++ \ keepend contains=@ScssSyntax,vueTag " Backward compatiable for `use_sass` option if s:use_sass && !s:use_scss syntax region cssScssVueStyle fold \ start=+]*lang=["']scss["'][^>]*>+ \ end=++ \ keepend contains=@SassSyntax,vueTag endif syntax region cssStylusVueStyle fold \ start=+]*lang=["']stylus["'][^>]*>+ \ end=++ \ keepend contains=@StylusSyntax,vueTag syntax region vueTag fold \ start=+^<[^/]+ end=+>+ skip=+>+ \ contains=htmlTagN,htmlString,htmlArg highlight default link vueTag htmlTag highlight default link cssUnitDecorators2 Number highlight default link cssKeyFrameProp2 Constant "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Custom blocks {{{ " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" runtime syntax/vue-custom-blocks.vim "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " Syntax patch {{{ " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Patch 7.4.1142 if has("patch-7.4-1142") if has("win32") syntax iskeyword @,48-57,_,128-167,224-235,$,- else syntax iskeyword @,48-57,_,192-255,$,- endif else setlocal iskeyword+=- endif " Style " Redefine (less|sass|stylus)Definition to highlight