Fix Vim built-in javascript indent on closing parenthesis

This commit is contained in:
leafOfTree
2021-04-14 12:01:33 +08:00
parent 5be2325222
commit c71f55019b

View File

@@ -200,12 +200,13 @@ function! s:AdjustJavaScriptIndent(ind)
let curline = getline(v:lnum)
" Fix Vim built-in javascript indent
if prevline =~? '\w\+(\s*$'
if prevline =~ '\w\+(\s*$'
call vue#LogWithLnum('previous line is a function call, this line is its first arg')
let prevind = indent(prevlnum)
if ind == prevind
let ind = prevind + &sw
endif
let ind = indent(prevlnum) + &sw
endif
if curline =~ '^\s*);\?\s*$'
call vue#LogWithLnum('this line is the closing parenthesis of the function call')
let ind = indent(prevlnum) - &sw
endif
return ind
endfunction