mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-08-13 19:31:01 +08:00
chore: add helper
This commit is contained in:
+20
-2
@@ -43,14 +43,14 @@ runtime! indent/xml.vim
|
|||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
runtime! indent/css.vim
|
runtime! indent/css.vim
|
||||||
|
|
||||||
|
" Load pug indent method
|
||||||
if s:use_pug
|
if s:use_pug
|
||||||
" Load pug indent method
|
|
||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
runtime! indent/pug.vim
|
runtime! indent/pug.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Load sass indent method
|
||||||
if s:use_sass
|
if s:use_sass
|
||||||
" Load sass indent method
|
|
||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
runtime! indent/sass.vim
|
runtime! indent/sass.vim
|
||||||
endif
|
endif
|
||||||
@@ -96,6 +96,24 @@ function! s:SynsVueScope(syns)
|
|||||||
return first_syn =~? '\v^(vueStyle)|(vueScript)'
|
return first_syn =~? '\v^(vueStyle)|(vueScript)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! GetVueCurrentTag()
|
||||||
|
let lnum = getcurpos()[1]
|
||||||
|
let cursyns = s:SynsEOL(lnum)
|
||||||
|
let first_syn = get(cursyns, 0)
|
||||||
|
|
||||||
|
if first_syn =~ 'vueTemplate.*'
|
||||||
|
let tag = 'template'
|
||||||
|
elseif first_syn =~ 'vueScript.*'
|
||||||
|
let tag = 'script'
|
||||||
|
elseif first_syn =~ 'vueStyle.*'
|
||||||
|
let tag = 'style'
|
||||||
|
else
|
||||||
|
let tag = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return tag
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! GetVueIndent()
|
function! GetVueIndent()
|
||||||
let curline = getline(v:lnum)
|
let curline = getline(v:lnum)
|
||||||
let prevline = getline(v:lnum - 1)
|
let prevline = getline(v:lnum - 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user