From c71f55019baa73bcb252ed54b3721b6e5a0fb1a4 Mon Sep 17 00:00:00 2001 From: leafOfTree Date: Wed, 14 Apr 2021 12:01:33 +0800 Subject: [PATCH] Fix Vim built-in javascript indent on closing parenthesis --- indent/vue.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/indent/vue.vim b/indent/vue.vim index 9a61ba8..a6f88f3 100644 --- a/indent/vue.vim +++ b/indent/vue.vim @@ -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