forked from OSchip/llvm-project
Vim: Fix some bugs in llvm indent plugin.
llvm-svn: 236464
This commit is contained in:
parent
825b32acb4
commit
19ffc26c5e
|
@ -25,7 +25,7 @@ if exists("*GetLLVMIndent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! FindOpenBracket(lnum)
|
function! FindOpenBrace(lnum)
|
||||||
call cursor(a:lnum, 1)
|
call cursor(a:lnum, 1)
|
||||||
return searchpair('{', '', '}', 'bW')
|
return searchpair('{', '', '}', 'bW')
|
||||||
endfun
|
endfun
|
||||||
|
@ -44,7 +44,7 @@ function! GetLLVMIndent()
|
||||||
|
|
||||||
" Indent labels the same as the current opening block
|
" Indent labels the same as the current opening block
|
||||||
if thisline =~ ':\s*$'
|
if thisline =~ ':\s*$'
|
||||||
let blockbegin = FindOpenBracket(v:lnum)
|
let blockbegin = FindOpenBrace(v:lnum)
|
||||||
if blockbegin > 0
|
if blockbegin > 0
|
||||||
return indent(blockbegin)
|
return indent(blockbegin)
|
||||||
endif
|
endif
|
||||||
|
@ -52,7 +52,7 @@ function! GetLLVMIndent()
|
||||||
|
|
||||||
" Find a non-blank not-completely commented line above the current line.
|
" Find a non-blank not-completely commented line above the current line.
|
||||||
let prev_lnum = prevnonblank(v:lnum - 1)
|
let prev_lnum = prevnonblank(v:lnum - 1)
|
||||||
while prev_num > 0 && synIDattr(synID(prev_lnum, indent(prev_lnum)+1, 0), "name") =? "string\|comment"
|
while prev_lnum > 0 && synIDattr(synID(prev_lnum, indent(prev_lnum)+1, 0), "name") =? "string\|comment"
|
||||||
let prev_lnum = prevnonblank(prev_lnum-1)
|
let prev_lnum = prevnonblank(prev_lnum-1)
|
||||||
endwhile
|
endwhile
|
||||||
" Hit the start of the file, use zero indent.
|
" Hit the start of the file, use zero indent.
|
||||||
|
|
Loading…
Reference in New Issue