refact: set LogMsg as script local function

This commit is contained in:
yemai
2018-10-25 12:26:18 +08:00
parent 775029143b
commit 699d56bedb

View File

@@ -73,10 +73,10 @@ function! GetVueIndent()
let prevsyns = SynsEOL(v:lnum - 1) let prevsyns = SynsEOL(v:lnum - 1)
if SynsPugish(prevsyns) if SynsPugish(prevsyns)
call LogMsg('type: pug') call s:LogMsg('type: pug')
let ind = GetPugIndent() let ind = GetPugIndent()
elseif SynsHTMLish(prevsyns) elseif SynsHTMLish(prevsyns)
call LogMsg('type: html') call s:LogMsg('type: html')
let ind = XmlIndentGet(v:lnum, 0) let ind = XmlIndentGet(v:lnum, 0)
" Align '/>' and '>' with '<' for multiline tags. " Align '/>' and '>' with '<' for multiline tags.
@@ -89,10 +89,10 @@ function! GetVueIndent()
endif endif
elseif SynsCSSish(prevsyns) elseif SynsCSSish(prevsyns)
call LogMsg('type: css') call s:LogMsg('type: css')
let ind = GetCSSIndent() let ind = GetCSSIndent()
else else
call LogMsg('type: javascript') call s:LogMsg('type: javascript')
if len(b:vue_js_indentexpr) if len(b:vue_js_indentexpr)
let ind = eval(b:vue_js_indentexpr) let ind = eval(b:vue_js_indentexpr)
else else
@@ -101,26 +101,26 @@ function! GetVueIndent()
endif endif
if curline =~? s:vue_tag if curline =~? s:vue_tag
call LogMsg('cur vue tag') call s:LogMsg('cur vue tag')
let ind = 0 let ind = 0
elseif (exists("g:vim_vue_plugin_has_init_indent") elseif (exists("g:vim_vue_plugin_has_init_indent")
\ && g:vim_vue_plugin_has_init_indent != 0) \ && g:vim_vue_plugin_has_init_indent != 0)
if SynsVueScope(cursyns) && ind == 0 if SynsVueScope(cursyns) && ind == 0
call LogMsg('add init') call s:LogMsg('add init')
let ind = &sw let ind = &sw
endif endif
else else
if prevline =~? s:vue_tag_no_indent if prevline =~? s:vue_tag_no_indent
call LogMsg('prev vue tag') call s:LogMsg('prev vue tag')
let ind = 0 let ind = 0
endif endif
endif endif
call LogMsg('result ind: '.ind) call s:LogMsg('result ind: '.ind)
return ind return ind
endfunction endfunction
function! LogMsg(msg) function! s:LogMsg(msg)
if g:vim_vue_plugin_debug if g:vim_vue_plugin_debug
echom '['.s:name.'] '. a:msg echom '['.s:name.'] '. a:msg
endif endif