default für b:commentstring
git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@165 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
6db599f2e0
commit
5293b7dfa5
@ -627,7 +627,12 @@ function ReformatIndent (fromline,toline)
|
|||||||
let line_nr = a:fromline
|
let line_nr = a:fromline
|
||||||
while (line_nr <= a:toline)
|
while (line_nr <= a:toline)
|
||||||
let line = getline(line_nr)
|
let line = getline(line_nr)
|
||||||
if (match(line,'^' . b:commentstring)>=0)
|
if !exists("b:commentstring")
|
||||||
|
let commentstring = b:commentstring
|
||||||
|
else
|
||||||
|
let commentstring = '#'
|
||||||
|
endif
|
||||||
|
if (match(line,'^' . commentstring)>=0)
|
||||||
let line = '@' . line
|
let line = '@' . line
|
||||||
" echo line
|
" echo line
|
||||||
call setline(line_nr, line)
|
call setline(line_nr, line)
|
||||||
@ -637,7 +642,7 @@ function ReformatIndent (fromline,toline)
|
|||||||
" indent all lines
|
" indent all lines
|
||||||
execute 'normal ' . a:fromline . 'G=' . a:toline . 'G'
|
execute 'normal ' . a:fromline . 'G=' . a:toline . 'G'
|
||||||
" reindent commented lines
|
" reindent commented lines
|
||||||
let substCmd = 's?^\s*@' . b:commentstring . '?' . b:commentstring . '?'
|
let substCmd = 's?^\s*@' . commentstring . '?' . commentstring . '?'
|
||||||
silent! execute a:fromline . ',' . a:toline . substCmd
|
silent! execute a:fromline . ',' . a:toline . substCmd
|
||||||
" go back to mark
|
" go back to mark
|
||||||
call cursor(cursorLine, cursorCol)
|
call cursor(cursorLine, cursorCol)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user