Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,26 @@ function s:IsBlock()
let l:ln = line('.')
if search('\S','bW')
let char = getline(line('.'))[col('.')-1]
let prechar = getline(line('.'))[col('.')-2]
if char == '/' && prechar == '*' && synIDattr(synID(line('.'),col('.'),0),'name') =~? 'comment'
let pchar = getline(line('.'))[col('.')-2]
let syn = synIDattr(synID(line('.'),col('.')-1,0),'name')
if char == '/' && pchar == '*' && syn =~? 'comment'
if !(search('\/\*','bW') && search('\S','bW'))
return 1
endif
let char = getline(line('.'))[col('.')-1]
let prechar = getline(line('.'))[col('.')-2]
let pchar = getline(line('.'))[col('.')-2]
let syn = synIDattr(synID(line('.'),col('.')-1,0),'name')
endif
let syn = synIDattr(synID(line('.'),col('.')-1,0),'name')
if syn =~? '\%(xml\|jsx\)'
return char != '{'
elseif char =~# '\l'
if line('.') == l:ln && expand('<cword>') ==# 'return'
return 0
endif
return expand('<cword>') !~#
\ '^\%(var\|const\|let\|import\|export\|yield\|de\%(fault\|lete\)\|void\|t\%(ypeof\|hrow\)\|new\|in\%(stanceof\)\=\)$'
\ '^\%(const\|let\|import\|export\|yield\|de\%(fault\|lete\)\|v\%(ar\|oid\)\|t\%(ypeof\|hrow\)\|new\|in\%(stanceof\)\=\)$'
elseif char == '>'
return prechar == '=' || syn =~? '^jsflow'
return pchar == '=' || syn =~? '^jsflow'
elseif char == ':'
return strpart(getline(line('.')),0,col('.')) =~# s:expr_case . '$'
else
Expand Down