mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2025-12-08 21:54:46 +08:00
Support coffee indent
This commit is contained in:
@@ -38,6 +38,9 @@ let s:use_pug = exists("g:vim_vue_plugin_use_pug")
|
|||||||
\ && g:vim_vue_plugin_use_pug == 1
|
\ && g:vim_vue_plugin_use_pug == 1
|
||||||
let s:use_sass = exists("g:vim_vue_plugin_use_sass")
|
let s:use_sass = exists("g:vim_vue_plugin_use_sass")
|
||||||
\ && g:vim_vue_plugin_use_sass == 1
|
\ && g:vim_vue_plugin_use_sass == 1
|
||||||
|
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
|
||||||
|
\ && g:vim_vue_plugin_use_coffee == 1
|
||||||
|
|
||||||
let s:has_init_indent = 0
|
let s:has_init_indent = 0
|
||||||
if !exists("g:vim_vue_plugin_has_init_indent")
|
if !exists("g:vim_vue_plugin_has_init_indent")
|
||||||
let ext = expand("%:e")
|
let ext = expand("%:e")
|
||||||
@@ -73,6 +76,11 @@ if s:use_sass
|
|||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
runtime! indent/sass.vim
|
runtime! indent/sass.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if s:use_coffee
|
||||||
|
unlet! b:did_indent
|
||||||
|
runtime! indent/coffee.vim
|
||||||
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
@@ -129,6 +137,9 @@ function! GetVueIndent()
|
|||||||
elseif s:SynPug(prevsyn)
|
elseif s:SynPug(prevsyn)
|
||||||
call s:Log('syntax: pug')
|
call s:Log('syntax: pug')
|
||||||
let ind = GetPugIndent()
|
let ind = GetPugIndent()
|
||||||
|
elseif s:SynCoffee(prevsyn)
|
||||||
|
call s:Log('syntax: coffee')
|
||||||
|
let ind = GetCoffeeIndent(v:lnum)
|
||||||
elseif s:SynSASS(prevsyn)
|
elseif s:SynSASS(prevsyn)
|
||||||
call s:Log('syntax: sass')
|
call s:Log('syntax: sass')
|
||||||
let ind = GetSassIndent()
|
let ind = GetSassIndent()
|
||||||
@@ -180,6 +191,10 @@ function! s:SynPug(syn)
|
|||||||
return a:syn ==? 'pugVueTemplate'
|
return a:syn ==? 'pugVueTemplate'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:SynCoffee(syn)
|
||||||
|
return a:syn ==? 'coffeeVueScript'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:SynSASS(syn)
|
function! s:SynSASS(syn)
|
||||||
return a:syn ==? 'cssSassVueStyle'
|
return a:syn ==? 'cssSassVueStyle'
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -107,42 +107,6 @@ if s:use_coffee
|
|||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
"
|
|
||||||
" 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
|
|
||||||
|
|
||||||
" Clear htmlHead that may cause highlighting out of bounds
|
|
||||||
syntax clear htmlHead
|
|
||||||
|
|
||||||
" Redefine syn-region to color <style> correctly.
|
|
||||||
if s:use_less
|
|
||||||
syntax region lessDefinition matchgroup=cssBraces contains=@LessSyntax contained
|
|
||||||
\ start="{" end="}"
|
|
||||||
endif
|
|
||||||
if s:use_sass
|
|
||||||
syntax region sassDefinition matchgroup=cssBraces contains=@SassSyntax contained
|
|
||||||
\ start="{" end="}"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Number with minus
|
|
||||||
syntax match javaScriptNumber '\v<-?\d+L?>|0[xX][0-9a-fA-F]+>' containedin=@javascriptVueScript
|
|
||||||
|
|
||||||
" html5 data-*
|
|
||||||
syntax match htmlArg '\v<data(-[.a-z0-9]+)+>' containedin=@HTMLSyntax
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
"
|
"
|
||||||
" Syntax highlight {{{
|
" Syntax highlight {{{
|
||||||
@@ -200,5 +164,51 @@ syntax region vueTag
|
|||||||
highlight def link vueTag htmlTag
|
highlight def link vueTag htmlTag
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" 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 syn-region to color <style> correctly.
|
||||||
|
if s:use_less
|
||||||
|
syntax region lessDefinition matchgroup=cssBraces contains=@LessSyntax contained
|
||||||
|
\ start="{" end="}"
|
||||||
|
endif
|
||||||
|
if s:use_sass
|
||||||
|
syntax region sassDefinition matchgroup=cssBraces contains=@SassSyntax contained
|
||||||
|
\ start="{" end="}"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Coffee
|
||||||
|
if s:use_coffee
|
||||||
|
silent! syntax clear coffeeConstant
|
||||||
|
syn match coffeeConstant /\<\u\C[A-Z0-9_]\+\>/ display
|
||||||
|
\ containedin=@coffeeIdentifier
|
||||||
|
endif
|
||||||
|
|
||||||
|
" JavaScript
|
||||||
|
" Number with minus
|
||||||
|
syntax match javaScriptNumber '\v<-?\d+L?>|0[xX][0-9a-fA-F]+>' containedin=@javascriptVueScript display
|
||||||
|
|
||||||
|
" HTML
|
||||||
|
" Clear htmlHead that may cause highlighting out of bounds
|
||||||
|
silent! syntax clear htmlHead
|
||||||
|
|
||||||
|
" html5 data-*
|
||||||
|
syntax match htmlArg '\v<data(-[.a-z0-9]+)+>' containedin=@HTMLSyntax
|
||||||
|
"}}}
|
||||||
|
|
||||||
let b:current_syntax = 'vue'
|
let b:current_syntax = 'vue'
|
||||||
" vim: fdm=marker
|
" vim: fdm=marker
|
||||||
|
|||||||
Reference in New Issue
Block a user