diff --git a/indent/vue.vim b/indent/vue.vim index 24fa37c..58e9d70 100644 --- a/indent/vue.vim +++ b/indent/vue.vim @@ -21,6 +21,7 @@ let s:languages = [ \ { 'name': 'css', 'pairs': [''] }, \ { 'name': 'coffee', 'pairs': [''] }, + \ { 'name': 'json', 'pairs': [''] }, \ ] for s:language in s:languages diff --git a/syntax/vue.vim b/syntax/vue.vim index 3d3d514..dd65dc9 100644 --- a/syntax/vue.vim +++ b/syntax/vue.vim @@ -42,6 +42,21 @@ function! s:register_language(language, tag, ...) endif endfunction +function! s:register_custom_tag(tag, language) + if s:syntax_available(a:language) + execute 'syntax include @' . a:language . ' syntax/' . a:language . '.vim' + unlet! b:current_syntax + execute 'syntax region vue_' . a:language + \ 'keepend' + \ 'start=/<' . a:tag . '\>\_[^>]*>/' + \ 'end=""me=s-1' + \ 'contains=@' . a:language . ',vueSurroundingTag' + \ 'fold' + endif +endfunction + +call s:register_custom_tag('i18n', 'json') + if !exists("g:vue_disable_pre_processors") || !g:vue_disable_pre_processors call s:register_language('less', 'style') call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)')) @@ -55,7 +70,7 @@ if !exists("g:vue_disable_pre_processors") || !g:vue_disable_pre_processors call s:register_language('scss', 'style') endif -syn region vueSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent +syn region vueSurroundingTag contained start=+<\(\w\|-\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent syn keyword htmlSpecialTagName contained template syn keyword htmlArg contained scoped ts syn match htmlArg "[@v:][-:.0-9_a-z]*\>" contained