From e2eb937757b804c19f1e33eb3c3a947bcead83f9 Mon Sep 17 00:00:00 2001 From: Chris Paul Date: Mon, 26 Sep 2016 17:04:52 -0700 Subject: [PATCH 1/3] clean isBlock It is awful to look at, also the regex may be optimized --- indent/javascript.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indent/javascript.vim b/indent/javascript.vim index e89e493d..7ef2eb6c 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -109,8 +109,9 @@ endfunction " https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader function s:IsBlock() - return getline(line('.'))[col('.')-1] == '{' && !search( - \ '\C\%(\\|\*\@\|\*\@ Date: Mon, 26 Sep 2016 17:22:17 -0700 Subject: [PATCH 2/3] Update javascript.vim --- indent/javascript.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indent/javascript.vim b/indent/javascript.vim index 7ef2eb6c..c7c2ce0d 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -109,10 +109,10 @@ endfunction " https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader function s:IsBlock() - return getline(line('.'))[col('.')-1] == '{' && !search('\\|\*\@') !~# + \ '\<\%(var\|const\|let\|import\|export\|yield\|de\%(fault\|lete\)\|void\|t\%(ypeof\|hrow\)\|new\|in\%(stanceof\)\=\)\>' + \ : !search('\C\%([-=~!<*+,.?^%|&\[(]\|=\@\|\*\@ Date: Mon, 26 Sep 2016 17:50:34 -0700 Subject: [PATCH 3/3] Update javascript.vim --- indent/javascript.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indent/javascript.vim b/indent/javascript.vim index c7c2ce0d..f38b7183 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -111,7 +111,7 @@ endfunction function s:IsBlock() return getline(line('.'))[col('.')-1] == '{' && !search('\') !~# \ '\<\%(var\|const\|let\|import\|export\|yield\|de\%(fault\|lete\)\|void\|t\%(ypeof\|hrow\)\|new\|in\%(stanceof\)\=\)\>' - \ : !search('\C\%([-=~!<*+,.?^%|&\[(]\|=\@\|\*\@\)\_s*\%#','nbW') && \ (search(s:expr_case . '\_s*\%#','nbW') || !search('[{:]\_s*\%#','bW') || s:IsBlock())) endfunction