Message from discussion
Bug: filetypes that rely on &sw fail after the patch which allows sw to be 0
Received: by 10.52.18.203 with SMTP id y11mr2363948vdd.6.1349467955469;
Fri, 05 Oct 2012 13:12:35 -0700 (PDT)
X-BeenThere: vim_dev@googlegroups.com
Received: by 10.220.141.4 with SMTP id k4ls3536877vcu.8.gmail; Fri, 05 Oct
2012 13:12:31 -0700 (PDT)
Received: by 10.52.72.197 with SMTP id f5mr1912429vdv.17.1349467951559;
Fri, 05 Oct 2012 13:12:31 -0700 (PDT)
Date: Fri, 5 Oct 2012 13:12:30 -0700 (PDT)
From: So8res <so8...@gmail.com>
To: vim_dev@googlegroups.com
Message-Id: <22138fb4-c8f7-4ef4-864d-524a8605c8fd@googlegroups.com>
In-Reply-To: <63c9d7c0-3d0c-4af6-9df2-74abfcfd2f33@googlegroups.com>
References: <63c9d7c0-3d0c-4af6-9df2-74abfcfd2f33@googlegroups.com>
Subject: Re: Bug: filetypes that rely on &sw fail after the patch which
allows sw to be 0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_232_3574963.1349467951054"
------=_Part_232_3574963.1349467951054
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Right, I missed the cases where people are setting &sw. Below is the updated patch. I've also separated out the runtime/ changes and the indent() changes.
Are people happy with re-using indent() here or should we add a shiftwidth() function?
Maintainers are going to be the bottleneck here. What's usual policy for backwards incompatible changes? This is an interesting case in that it's an opt-in backwards-incompatible change, so it won't break anything unexpectedly. But how do we announce to people that they need to update, and can we update a chunk of the runtime files ourselves?
On Wednesday, October 3, 2012 4:11:03 PM UTC-7, So8res wrote:
> Many filetypes use &sw in their indent files. Most prominent among these is the vim indent file itself.
>
> If you use the new feature that allows sw to be 0 (causing it to fall back to tabstop) then indentation in all of these filetypes breaks.
>
> According to a simple grep, the following filetypes are affected:
>
> ada
> awk
> bst
> cdl
> cmake
> cobol
> css
> cucumber
> dtd
> dylan
> eiffel
> erlang
> eruby
> eterm
> falcon
> fortran
> framescript
> gitconfig
> gitolite
> haml
> hamster
> html
> idlang
> ishd
> java
> ld
> liquid
> logtalk
> make
> matlab
> mma
> mp
> ocaml
> perl
> perl6
> php
> postscr
> pov
> prolog
> python
> r
> readline
> rpl
> ruby
> sass
> sdl
> sml
> sqlanywhere
> tcl
> tcsh
> tex
> tf
> tilde
> treetop
> vb
> verilog
> vhdl
> vim
> xf86conf
> xinetd
> xml
> zimbu
>
> I haven't updated my usr/local/share/vim/vim73 files since adding in this patch, are there updated vimfiles that I should be using? If not, is there a plan to update these indent files?
>
> If not, is there a way to make the change less breaking? It seems like there should be a "indent_level()" function of some sort for indenters to use now that &sw can no longer be trusted.
------=_Part_232_3574963.1349467951054
Content-Type: text/x-diff; charset=US-ASCII; name=indent_sw.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=indent_sw.diff
X-Attachment-Id: bc38cda7-6e61-44de-8439-c61018d47d77
diff -r 0769b84adf93 runtime/doc/eval.txt
--- a/runtime/doc/eval.txt Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/doc/eval.txt Fri Oct 05 13:07:04 2012 -0700
@@ -3681,13 +3681,14 @@
cannot use UCS-2 in a string anyway, because of the NUL bytes.
{only available when compiled with the |+multi_byte| feature}
- *indent()*
-indent({lnum}) The result is a Number, which is indent of line {lnum} in the
- current buffer. The indent is counted in spaces, the value
- of 'tabstop' is relevant. {lnum} is used just like in
- |getline()|.
- When {lnum} is invalid -1 is returned.
-
+indent([{lnum}]) *indent()*
+ If {lnum} is given the result is a Number, which is indent of
+ line {lnum} in the current buffer. The indent is counted in
+ spaces, the value of 'tabstop' is relevant. {lnum} is used
+ just like in |getline()|.
+ If {lnum} is not given, the true shiftwidth is returned. This
+ is the value of 'shiftwidth' unless 'shiftwidth' is zero, in
+ which case it is the value of 'tabstop'.
index({list}, {expr} [, {start} [, {ic}]]) *index()*
Return the lowest index in |List| {list} where the item has a
diff -r 0769b84adf93 runtime/doc/indent.txt
--- a/runtime/doc/indent.txt Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/doc/indent.txt Fri Oct 05 13:07:04 2012 -0700
@@ -715,11 +715,11 @@
that you can change the value of 'shiftwidth' later.
Indent after an open paren: >
- let g:pyindent_open_paren = '&sw * 2'
+ let g:pyindent_open_paren = 'indent() * 2'
Indent after a nested paren: >
- let g:pyindent_nested_paren = '&sw'
+ let g:pyindent_nested_paren = 'indent()'
Indent for a continuation line: >
- let g:pyindent_continue = '&sw * 2'
+ let g:pyindent_continue = 'indent() * 2'
R *ft-r-indent*
@@ -805,10 +805,10 @@
au BufReadPost * endif
Furthermore, setting the variable b:verilog_indent_width to change the
-indenting width (default is 'shiftwidth'): >
+indenting width (default is |indent()|): >
let b:verilog_indent_width = 4
- let b:verilog_indent_width = &sw * 2
+ let b:verilog_indent_width = indent() * 2
In addition, you can turn the verbose mode for debug issue: >
@@ -931,9 +931,9 @@
For indenting Vim scripts there is one variable that specifies the amount of
indent for a continuation line, a line that starts with a backslash: >
- :let g:vim_indent_cont = &sw * 3
+ :let g:vim_indent_cont = indent() * 3
-Three times shiftwidth is the default value.
+Three times |indent()| is the default value.
vim:tw=78:ts=8:ft=help:norl:
diff -r 0769b84adf93 runtime/doc/options.txt
--- a/runtime/doc/options.txt Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/doc/options.txt Fri Oct 05 13:07:04 2012 -0700
@@ -6120,6 +6120,8 @@
Number of spaces to use for each step of (auto)indent. Used for
|'cindent'|, |>>|, |<<|, etc.
When zero the 'ts' value will be used.
+ Since 'shiftwidth' can be zero, you can not trust it in scripts. To
+ get the true value use the |indent()| function instead.
*'shortmess'* *'shm'*
'shortmess' 'shm' string (Vim default "filnxtToO", Vi default: "",
diff -r 0769b84adf93 src/eval.c
--- a/src/eval.c Fri Oct 05 21:30:08 2012 +0200
+++ b/src/eval.c Fri Oct 05 13:07:04 2012 -0700
@@ -7950,7 +7950,7 @@
{"hlexists", 1, 1, f_hlexists},
{"hostname", 0, 0, f_hostname},
{"iconv", 3, 3, f_iconv},
- {"indent", 1, 1, f_indent},
+ {"indent", 0, 1, f_indent},
{"index", 2, 4, f_index},
{"input", 1, 3, f_input},
{"inputdialog", 1, 3, f_inputdialog},
@@ -12826,11 +12826,15 @@
{
linenr_T lnum;
- lnum = get_tv_lnum(argvars);
- if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
- rettv->vval.v_number = get_indent_lnum(lnum);
- else
- rettv->vval.v_number = -1;
+ if (argvars[0].v_type == VAR_UNKNOWN)
+ rettv->vval.v_number = get_sw_value();
+ else {
+ lnum = get_tv_lnum(argvars);
+ if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
+ rettv->vval.v_number = get_indent_lnum(lnum);
+ else
+ rettv->vval.v_number = -1;
+ }
}
/*
------=_Part_232_3574963.1349467951054
Content-Type: text/x-diff; charset=UTF-8; name=indent_runtimefiles_fix.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=indent_runtimefiles_fix.diff
X-Attachment-Id: 95a6a323-cae9-4f99-aa57-88bf93cf7981
diff -r 0769b84adf93 runtime/autoload/ada.vim
--- a/runtime/autoload/ada.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/autoload/ada.vim Fri Oct 05 13:11:27 2012 -0700
@@ -520,9 +520,9 @@
" gnat outdents a line which stards with a ( by one characters so
" that parameters which follow are aligned.
"
- let l:Level = (indent (a:Line) + 1) / &shiftwidth
+ let l:Level = (indent (a:Line) + 1) / indent()
else
- let l:Level = indent (a:Line) / &shiftwidth
+ let l:Level = indent (a:Line) / indent()
endif
return l:Level
diff -r 0769b84adf93 runtime/ftplugin/cobol.vim
--- a/runtime/ftplugin/cobol.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/ftplugin/cobol.vim Fri Oct 05 13:11:27 2012 -0700
@@ -113,7 +113,7 @@
function! s:increase(...)
let lnum = '.'
- let sw = &shiftwidth
+ let sw = indent()
let i = a:0 ? a:1 : indent(lnum)
if i >= 11
return sw - (i - 11) % sw
@@ -128,7 +128,7 @@
function! s:decrease(...)
let lnum = '.'
- let sw = &shiftwidth
+ let sw = indent()
let i = indent(a:0 ? a:1 : lnum)
if i >= 11 + sw
return 1 + (i + 12) % sw
@@ -147,7 +147,7 @@
let head = strpart(getline('.'),0,7)
let tail = strpart(getline('.'),7)
let indent = match(tail,'[^ ]')
- let sw = &shiftwidth
+ let sw = indent()
let shift = a:shift
if shift > 0
if indent < 4
@@ -185,7 +185,7 @@
endif
endif
let interval = s:increase()
- let b:cobol_shiftwidth = &shiftwidth
+ let b:cobol_shiftwidth = indent()
let &shiftwidth = 1
let lastchar = strpart(getline('.'),col('.')-2,1)
if lastchar == '0' || lastchar == '^'
@@ -205,7 +205,7 @@
endif
endif
let interval = s:decrease()
- let b:cobol_shiftwidth = &shiftwidth
+ let b:cobol_shiftwidth = indent()
let &shiftwidth = 1
return s:repeat(c,interval)
endfunction
@@ -221,7 +221,7 @@
function! s:Tab()
if (strpart(getline('.'),0,col('.')-1) =~ '^\s*$' && &sta)
return s:IncreaseIndent()
- elseif &sts == &sw && &sts != 8 && &et
+ elseif &sts == indent() && &sts != 8 && &et
return s:repeat(" ",s:increase(col('.')-1))
else
return "\<Tab>"
diff -r 0769b84adf93 runtime/indent/ada.vim
--- a/runtime/indent/ada.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/ada.vim Fri Oct 05 13:11:27 2012 -0700
@@ -87,7 +87,7 @@
endwhile
endwhile
" Fallback - just move back one
- return a:prev_indent - &sw
+ return a:prev_indent - indent()
endfunction MainBlockIndent
" Section: s:EndBlockIndent {{{1
@@ -131,7 +131,7 @@
endwhile
endwhile
" Fallback - just move back one
- return a:prev_indent - &sw
+ return a:prev_indent - indent()
endfunction EndBlockIndent
" Section: s:StatementIndent {{{1
@@ -213,15 +213,15 @@
endif
" Move indent in
if ! false_match
- let ind = ind + &sw
+ let ind = ind + indent()
endif
elseif line =~ '^\s*\(case\|exception\)\>'
" Move indent in twice (next 'when' will move back)
- let ind = ind + 2 * &sw
+ let ind = ind + 2 * indent()
elseif line =~ '^\s*end\s*record\>'
" Move indent back to tallying 'type' preceeding the 'record'.
" Allow indent to be equal to 'end record's.
- let ind = s:MainBlockIndent( ind+&sw, lnum, 'type\>', '' )
+ let ind = s:MainBlockIndent( ind+indent(), lnum, 'type\>', '' )
elseif line =~ '\(^\s*new\>.*\)\@<!)\s*[;,]\s*$'
" Revert to indent of line that started this parenthesis pair
exe lnum
@@ -235,10 +235,10 @@
exe v:lnum
elseif line =~ '[.=(]\s*$'
" A statement continuation - move in one
- let ind = ind + &sw
+ let ind = ind + indent()
elseif line =~ '^\s*new\>'
" Multiple line generic instantiation ('package blah is\nnew thingy')
- let ind = s:StatementIndent( ind - &sw, lnum )
+ let ind = s:StatementIndent( ind - indent(), lnum )
elseif line =~ ';\s*$'
" Statement end (but not 'end' ) - try to find current statement-start indent
let ind = s:StatementIndent( ind, lnum )
@@ -256,17 +256,17 @@
elseif continuation && line =~ '^\s*('
" Don't do this if we've already indented due to the previous line
if ind == initind
- let ind = ind + &sw
+ let ind = ind + indent()
endif
elseif line =~ '^\s*\(begin\|is\)\>'
let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' )
elseif line =~ '^\s*record\>'
- let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + &sw
+ let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + indent()
elseif line =~ '^\s*\(else\|elsif\)\>'
let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' )
elseif line =~ '^\s*when\>'
" Align 'when' one /in/ from matching block start
- let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + &sw
+ let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + indent()
elseif line =~ '^\s*end\>\s*\<if\>'
" End of if statements
let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' )
diff -r 0769b84adf93 runtime/indent/awk.vim
--- a/runtime/indent/awk.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/awk.vim Fri Oct 05 13:11:27 2012 -0700
@@ -60,7 +60,7 @@
" 'pattern { action }' (simple check match on /{/ increases the indent then)
if s:Get_brace_balance( prev_data, '{', '}' ) > 0
- return ind + &sw
+ return ind + indent()
endif
let brace_balance = s:Get_brace_balance( prev_data, '(', ')' )
@@ -99,7 +99,7 @@
return s:Safe_indent( ind, s:First_word_len(prev_data), getline(v:lnum))
else
" if/for/while without '{'
- return ind + &sw
+ return ind + indent()
endif
endif
endif
@@ -140,7 +140,7 @@
" Decrease indent if this line contains a '}'.
if getline(v:lnum) =~ '^\s*}'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/bst.vim
--- a/runtime/indent/bst.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/bst.vim Fri Oct 05 13:11:27 2012 -0700
@@ -69,7 +69,7 @@
endif
let fakeline = substitute(line,'^}','','').matchstr(cline,'^}')
let ind = indent(lnum)
- let ind = ind + &sw * s:count(line,'{')
- let ind = ind - &sw * s:count(fakeline,'}')
+ let ind = ind + indent() * s:count(line,'{')
+ let ind = ind - indent() * s:count(fakeline,'}')
return ind
endfunction
diff -r 0769b84adf93 runtime/indent/cdl.vim
--- a/runtime/indent/cdl.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/cdl.vim Fri Oct 05 13:11:27 2012 -0700
@@ -47,7 +47,7 @@
let thisline = getline(a:lnum)
if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0
" it's an attributes line
- return &sw
+ return indent()
elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0
" it's a header or '{' or '}' or a comment
return 0
@@ -71,13 +71,13 @@
let c = line[inicio-1]
" ')' and '=' don't change indent and are useless to set 'f'
if c == '{'
- return &sw
+ return indent()
elseif c != ')' && c != '='
let f = 1 " all but 'elseif' are followed by a formula
if c ==? 'n' || c ==? 'e' " 'then', 'else'
- let ind = ind + &sw
+ let ind = ind + indent()
elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional
- let ind = ind + &sw
+ let ind = ind + indent()
let f = 0
end
end
@@ -98,16 +98,16 @@
let ind = 0
let f = 1
elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif'
- let ind = ind - &sw
+ let ind = ind - indent()
elseif c == '(' || c ==? 'f' " '(' or 'if'
- let ind = ind + &sw
+ let ind = ind + indent()
else " c == '='
" if it is an asignment increase indent
if f == -1 " we don't know yet, find out
let f = CdlAsignment(lnum, strpart(line, 0, inicio))
end
if f == 1 " formula increase it
- let ind = ind + &sw
+ let ind = ind + indent()
end
end
endw
@@ -115,13 +115,13 @@
" CURRENT LINE, if it starts with a closing element, decrease indent
" or if it starts with '=' (asignment), increase indent
if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0
- let ind = ind - &sw
+ let ind = ind - indent()
elseif match(thisline, '^\s*=') >= 0
if f == -1 " we don't know yet if is an asignment, find out
let f = CdlAsignment(lnum, "")
end
if f == 1 " formula increase it
- let ind = ind + &sw
+ let ind = ind + indent()
end
end
diff -r 0769b84adf93 runtime/indent/chaiscript.vim
--- a/runtime/indent/chaiscript.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/chaiscript.vim Fri Oct 05 13:11:27 2012 -0700
@@ -31,19 +31,19 @@
let flag = 0
let prevline = getline(lnum)
if prevline =~ '^.*{.*'
- let ind = ind + &shiftwidth
+ let ind = ind + indent()
let flag = 1
endif
" Subtract a 'shiftwidth' after lines containing a { followed by a }
" to keep it balanced
if flag == 1 && prevline =~ '.*{.*}.*'
- let ind = ind - &shiftwidth
+ let ind = ind - indent()
endif
" Subtract a 'shiftwidth' on lines ending with }
if getline(v:lnum) =~ '^\s*\%(}\)'
- let ind = ind - &shiftwidth
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/cmake.vim
--- a/runtime/indent/cmake.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/cmake.vim Fri Oct 05 13:11:27 2012 -0700
@@ -68,19 +68,19 @@
let ind = ind
else
if previous_line =~? cmake_indent_begin_regex
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if previous_line =~? cmake_indent_open_regex
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
" Subtract
if this_line =~? cmake_indent_end_regex
- let ind = ind - &sw
+ let ind = ind - indent()
endif
if previous_line =~? cmake_indent_close_regex
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/cobol.vim
--- a/runtime/indent/cobol.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/cobol.vim Fri Oct 05 13:11:27 2012 -0700
@@ -52,11 +52,11 @@
if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin
let ind = indent(lastclause)
elseif lastclause > 0
- let ind = indent(lastclause) + &sw
- "let ind = ind + &sw
+ let ind = indent(lastclause) + indent()
+ "let ind = ind + indent()
endif
elseif line =~? clauses && cline !~? end
- let ind = ind + &sw
+ let ind = ind + indent()
endif
return ind
endfunction
@@ -98,8 +98,8 @@
let num = matchstr(line,'^\s*\zs\d\+\>')
if 0+cnum == num
return lindent
- elseif 0+cnum > num && default < lindent + &sw
- let default = lindent + &sw
+ elseif 0+cnum > num && default < lindent + indent()
+ let default = lindent + indent()
endif
elseif lindent < bshft && lindent >= ashft
break
@@ -135,13 +135,13 @@
if line =~? '^PERFORM\>'
let perfline = substitute(line, '\c^PERFORM\s*', "", "")
if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$'
- let ind = ind + &sw
+ let ind = ind + indent()
elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
let ind = s:optionalblock(a:lnum,ind,'ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT','ON\s\+SIZE\s\+ERROR')
let ind = s:optionalblock(a:lnum,ind,'STRING\|UNSTRING\|ACCEPT\|DISPLAY\|CALL','ON\s\+OVERFLOW\|ON\s\+EXCEPTION')
@@ -157,10 +157,10 @@
"&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>'
let ind = indent(lastclause)
elseif lastclause > 0
- let ind = indent(lastclause) + &sw
+ let ind = indent(lastclause) + indent()
endif
elseif line =~? '^WHEN\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
"I'm not sure why I had this
"if line =~? '^ELSE\>-\@!' && line !~? '\.$'
@@ -168,7 +168,7 @@
"endif
if cline =~? '^\(END\)\>-\@!'
" On lines with just END, 'guess' a simple shift left
- let ind = ind - &sw
+ let ind = ind - indent()
elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!'
call cursor(a:lnum,indent(a:lnum))
let match = searchpair('\c-\@<!\<IF\>','\c-\@<!\%(THEN\|ELSE\)\>','\c-\@<!\<END-IF\>\zs','bnW',s:skip)
@@ -209,7 +209,7 @@
if match > 0
let ind = indent(match)
elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
return ind < bshft ? bshft : ind
diff -r 0769b84adf93 runtime/indent/css.vim
--- a/runtime/indent/css.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/css.vim Fri Oct 05 13:11:27 2012 -0700
@@ -75,8 +75,8 @@
return 0
endif
- return indent(pnum) + s:count_braces(pnum, 1) * &sw
- \ - s:count_braces(v:lnum, 0) * &sw
+ return indent(pnum) + s:count_braces(pnum, 1) * indent()
+ \ - s:count_braces(v:lnum, 0) * indent()
endfunction
let &cpo = s:keepcpo
diff -r 0769b84adf93 runtime/indent/cucumber.vim
--- a/runtime/indent/cucumber.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/cucumber.vim Fri Oct 05 13:11:27 2012 -0700
@@ -29,28 +29,28 @@
if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
return 0
elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
- return 2 * &sw
+ return 2 * indent()
elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
- return &sw
+ return indent()
elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
- return &sw
+ return indent()
elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
- return 3 * &sw
+ return 3 * indent()
elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
- return 2 * &sw
+ return 2 * indent()
elseif cline =~# '^\s*@' && (s:syn(nextnonblank(v:lnum+1)) == 'cucumberFeature' || getline(nextnonblank(v:lnum+1)) =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
return 0
elseif line =~# '^\s*@'
- return &sw
+ return indent()
elseif cline =~# '^\s*|' && line =~# '^\s*|'
return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|#]'
- return indent(prevnonblank(v:lnum-1)) + &sw
+ return indent(prevnonblank(v:lnum-1)) + indent()
elseif cline =~# '^\s*[^|# \t]' && line =~# '^\s*|'
- return indent(prevnonblank(v:lnum-1)) - &sw
+ return indent(prevnonblank(v:lnum-1)) - indent()
elseif cline =~# '^\s*$' && line =~# '^\s*|'
let in = indent(prevnonblank(v:lnum-1))
- return in == indent(v:lnum) ? in : in - &sw
+ return in == indent(v:lnum) ? in : in - indent()
elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && getline(v:lnum+1) =~# '\S'
return indent(getline(v:lnum+1))
endif
diff -r 0769b84adf93 runtime/indent/dtd.vim
--- a/runtime/indent/dtd.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/dtd.vim Fri Oct 05 13:11:27 2012 -0700
@@ -84,7 +84,7 @@
let [declaration, end] = s:lex1(line, col)
if declaration == ""
- return indent + &sw
+ return indent + indent()
elseif declaration == '--'
" We?re looking at a comment. Now, simply determine if the comment is
" terminated or not. If it isn?t, let Vim take care of that using
@@ -100,7 +100,7 @@
" Check for element name. If none exists, indent one level.
let [name, end] = s:lex(line, end)
if name == ""
- return indent + &sw
+ return indent + indent()
endif
" Check for token following element name. This can be a specification of
@@ -113,7 +113,7 @@
let n += 1
endwhile
if token == ""
- return indent + &sw
+ return indent + indent()
endif
" Next comes the content model. If the token we?ve found isn?t a
@@ -148,7 +148,7 @@
return indent
endif
" TODO: Should use s:lex here on getline(v:lnum) and check for >.
- return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + &sw)
+ return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + indent())
endif
" If we?ve seen an addition or exception already and this is of the same
@@ -167,7 +167,7 @@
" Check for element name. If none exists, indent one level.
let [name, end] = s:lex(line, end)
if name == ""
- return indent + &sw
+ return indent + indent()
endif
" Check for any number of attributes.
@@ -180,7 +180,7 @@
let [name, end] = s:lex(line, end)
if name == ""
" TODO: Should use s:lex here on getline(v:lnum) and check for >.
- return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw)
+ return getline(v:lnum) =~ '^\s*>' ? indent : (indent + indent())
elseif name == ">"
return indent
endif
@@ -194,14 +194,14 @@
" (CDATA|NMTOKEN|NMTOKENS|ID|IDREF|IDREFS|ENTITY|ENTITIES)?
let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)')
if value == ""
- return indent + &sw * 2
+ return indent + indent() * 2
elseif value == 'NOTATION'
" If this is a enumerated value based on notations, read another token
" for the actual value. If it doesn?t exist, indent three levels.
" TODO: If validating according to above, value must be equal to '('.
let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)')
if value == ""
- return indent + &sw * 3
+ return indent + indent() * 3
endif
endif
@@ -216,13 +216,13 @@
" two levels.
let [default, end] = s:lex(line, end, '^\%("\_[^"]*"\|#\(REQUIRED\|IMPLIED\|FIXED\)\)')
if default == ""
- return indent + &sw * 2
+ return indent + indent() * 2
elseif default == '#FIXED'
" We need to look for the fixed value. If non exists, indent three
" levels.
let [default, end] = s:lex(line, end, '^"\_[^"]*"')
if default == ""
- return indent + &sw * 3
+ return indent + indent() * 3
endif
endif
endwhile
@@ -233,11 +233,11 @@
" again, if none exists, indent one level.
let [name, end] = s:lex(line, end)
if name == ""
- return indent + &sw
+ return indent + indent()
elseif name == '%'
let [name, end] = s:lex(line, end)
if name == ""
- return indent + &sw
+ return indent + indent()
endif
endif
@@ -256,27 +256,27 @@
" we?re now done with this entity.
let [value, end] = s:lex(line, end)
if value == ""
- return indent + &sw
+ return indent + indent()
elseif value == 'SYSTEM' || value == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)')
if quoted_string == ""
- return indent + &sw * 2
+ return indent + indent() * 2
endif
if value == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)')
if quoted_string == ""
- return indent + &sw * 2
+ return indent + indent() * 2
endif
endif
let [ndata, end] = s:lex(line, end)
if ndata == ""
- return indent + &sw
+ return indent + indent()
endif
let [name, end] = s:lex(line, end)
- return name == "" ? (indent + &sw * 2) : indent
+ return name == "" ? (indent + indent() * 2) : indent
else
return indent
endif
@@ -284,24 +284,24 @@
" Check for notation name. If none exists, indent one level.
let [name, end] = s:lex(line, end)
if name == ""
- return indent + &sw
+ return indent + indent()
endif
" Now check for the external ID. If none exists, indent one level.
let [id, end] = s:lex(line, end)
if id == ""
- return indent + &sw
+ return indent + indent()
elseif id == 'SYSTEM' || id == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)')
if quoted_string == ""
- return indent + &sw * 2
+ return indent + indent() * 2
endif
if id == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\|>\)')
if quoted_string == ""
" TODO: Should use s:lex here on getline(v:lnum) and check for >.
- return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw * 2)
+ return getline(v:lnum) =~ '^\s*>' ? indent : (indent + indent() * 2)
elseif quoted_string == '>'
return indent
endif
diff -r 0769b84adf93 runtime/indent/dylan.vim
--- a/runtime/indent/dylan.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/dylan.vim Fri Oct 05 13:11:27 2012 -0700
@@ -45,13 +45,13 @@
" If previous line was a 'define', indent
if prevline =~? '\(^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)\|\s*\S*\s*=>$\)'
- let chg = &sw
+ let chg = indent()
" local methods indent the shift-width, plus 6 for the 'local'
elseif prevline =~? '^\s*local'
- let chg = &sw + 6
+ let chg = indent() + 6
" If previous line was a let with no closing semicolon, indent
elseif prevline =~? '^\s*let.*[^;]\s*$'
- let chg = &sw
+ let chg = indent()
" If previous line opened a parenthesis, and did not close it, indent
elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
@@ -75,13 +75,13 @@
" line doesn't start with an indentable command:
let curr_str = getline(curr_line)
if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)'
- let chg = &sw
+ let chg = indent()
endif
endif
" If a line starts with end, un-indent (even if we just indented!)
if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)'
- let chg = chg - &sw
+ let chg = chg - indent()
endif
return ind + chg
diff -r 0769b84adf93 runtime/indent/eiffel.vim
--- a/runtime/indent/eiffel.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/eiffel.vim Fri Oct 05 13:11:27 2012 -0700
@@ -63,23 +63,23 @@
" Add a 'shiftwidth' after lines that start with an indent word
let ind = indent(lnum)
if getline(lnum) =~ s:relative_indent
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Indent to single indent
if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent
\ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>'
- let ind = &sw
+ let ind = indent()
endif
" Indent to double indent
if getline(v:lnum) =~ s:inheritance_dent
- let ind = 2 * &sw
+ let ind = 2 * indent()
endif
" Indent line after the first line of the function definition
if getline(lnum) =~ s:single_dent
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" The following should always be at the start of a line, no indenting
@@ -91,17 +91,17 @@
" or first thing after the 'do'
if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent
\ && getline(v:lnum - 1) !~ '^\s*do\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Subtract a shiftwidth for end statements
if getline(v:lnum) =~ '^\s*end\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" set indent of zero end statements that are at an indent of 3, this should
" only ever be the class's end.
- if getline(v:lnum) =~ '^\s*end\>' && ind == &sw
+ if getline(v:lnum) =~ '^\s*end\>' && ind == indent()
let ind = 0
endif
diff -r 0769b84adf93 runtime/indent/erlang.vim
--- a/runtime/indent/erlang.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/erlang.vim Fri Oct 05 13:11:27 2012 -0700
@@ -155,7 +155,7 @@
" lnum: line number
" return: the indentation level of the line
function s:GetLineIndent(lnum)
- return (indent(a:lnum) / &sw) * &sw
+ return (indent(a:lnum) / indent()) * indent()
endfunction
function ErlangIndent()
@@ -172,38 +172,38 @@
let ind_after = s:ErlangIndentAfterLine(prevline)
if ind_after != 0
- let ind = s:GetLineIndent(lnum) + ind_after * &sw
+ let ind = s:GetLineIndent(lnum) + ind_after * indent()
else
- let ind = indent(lnum) + ind_after * &sw
+ let ind = indent(lnum) + ind_after * indent()
endif
" Special cases:
if prevline =~# '^\s*\%(after\|end\)\>'
- let ind = ind + 2*&sw
+ let ind = ind + 2*indent()
endif
if currline =~# '^\s*end\>'
- let ind = ind - 2*&sw
+ let ind = ind - 2*indent()
endif
if currline =~# '^\s*after\>'
let plnum = s:FindPrevNonBlankNonComment(v:lnum-1)
if getline(plnum) =~# '^[^%]*\<receive\>\s*\%(%.*\)\=$'
" If the 'receive' is not in the same line as the 'after'
- let ind = ind - 1*&sw
+ let ind = ind - 1*indent()
else
- let ind = ind - 2*&sw
+ let ind = ind - 2*indent()
endif
endif
if prevline =~# '^\s*[)}\]]'
- let ind = ind + 1*&sw
+ let ind = ind + 1*indent()
endif
if currline =~# '^\s*[)}\]]'
- let ind = ind - 1*&sw
+ let ind = ind - 1*indent()
endif
if prevline =~# '^\s*\%(catch\)\s*\%(%\|$\)'
- let ind = ind + 1*&sw
+ let ind = ind + 1*indent()
endif
if currline =~# '^\s*\%(catch\)\s*\%(%\|$\)'
- let ind = ind - 1*&sw
+ let ind = ind - 1*indent()
endif
if ind<0
diff -r 0769b84adf93 runtime/indent/eruby.vim
--- a/runtime/indent/eruby.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/eruby.vim Fri Oct 05 13:11:27 2012 -0700
@@ -59,21 +59,21 @@
let line = getline(lnum)
let cline = getline(v:lnum)
if cline =~# '^\s*<%-\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
if line =~# '\S\s*<%-\=\s*\%(}\|end\).\{-\}\s*\%(-\=%>\|$\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*-\=%>'
- let ind = ind + &sw
+ let ind = ind + indent()
elseif line =~# '<%-\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if cline =~# '^\s*-\=%>\s*$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
endfunction
diff -r 0769b84adf93 runtime/indent/eterm.vim
--- a/runtime/indent/eterm.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/eterm.vim Fri Oct 05 13:11:27 2012 -0700
@@ -25,11 +25,11 @@
let ind = indent(lnum)
if getline(lnum) =~ '^\s*begin\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if getline(v:lnum) =~ '^\s*end\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/falcon.vim
--- a/runtime/indent/falcon.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/falcon.vim Fri Oct 05 13:11:27 2012 -0700
@@ -92,23 +92,23 @@
" If the start of the line equals a double quote, then indent to the
" previous lines first double quote
if cline =~? '^\s*"'
- let chg = chg + &sw
+ let chg = chg + indent()
endif
" If previous line started with a double quote and this one
" doesn't, unindent
if prevline =~? '^\s*"' && cline =~? '^\s*'
- let chg = chg - &sw
+ let chg = chg - indent()
endif
" Indent if proper keyword
if prevline =~? s:falcon_indent_keywords
- let chg = &sw
+ let chg = indent()
" If previous line opened a parenthesis, and did not close it, indent
elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
" Make sure this isn't just a function split between two lines
if prevline =~ ',\s*$'
- return indent(prevnonblank(v:lnum - 1)) + &sw
+ return indent(prevnonblank(v:lnum - 1)) + indent()
else
return match(prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
endif
@@ -132,22 +132,22 @@
" If previous line ends in a semi-colon reset indent to previous
" lines setting
if prevline =~? ';\s*$' && prevnonblank(prevline) =~? ',\s*$'
- return chg = chg - (2 * &sw)
+ return chg = chg - (2 * indent())
endif
" If previous line ended in a comma, indent again
if prevline =~? ',\s*$'
- let chg = chg + &sw
+ let chg = chg + indent()
endif
" If previous line ended in a =>, indent again
if prevline =~? '=>\s*$'
- let chg = chg + &sw
+ let chg = chg + indent()
endif
" Deindent on proper keywords
if cline =~? s:falcon_deindent_keywords
- let chg = chg - &sw
+ let chg = chg - indent()
endif
return ind + chg
diff -r 0769b84adf93 runtime/indent/fortran.vim
--- a/runtime/indent/fortran.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/fortran.vim Fri Oct 05 13:11:27 2012 -0700
@@ -81,10 +81,10 @@
"Indent do loops only if they are all guaranteed to be of do/end do type
if exists("b:fortran_do_enddo") || exists("g:fortran_do_enddo")
if prevstat =~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*do\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*end\s*do\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
@@ -94,14 +94,14 @@
\ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>'
\ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>'
\ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>'
- let ind = ind + &sw
+ let ind = ind + indent()
" Remove unwanted indent after logical and arithmetic ifs
if prevstat =~? '\<if\>' && prevstat !~? '\<then\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Remove unwanted indent after type( statements
if prevstat =~? '^\s*type\s*('
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
@@ -114,12 +114,12 @@
\ ||prevstat =~? '^\s*'.prefix.'subroutine\>'
\ ||prevstat =~? '^\s*'.prefix.type.'function\>'
\ ||prevstat =~? '^\s*'.type.prefix.'function\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if getline(v:lnum) =~? '^\s*contains\>'
\ ||getline(v:lnum)=~? '^\s*end\s*'
\ .'\(function\|subroutine\|module\|program\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
@@ -130,20 +130,20 @@
\. '\(else\|else\s*if\|else\s*where\|case\|'
\. 'end\s*\(if\|where\|select\|interface\|'
\. 'type\|forall\|associate\|enum\)\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
" Fix indent for case statement immediately after select
if prevstat =~? '\<select\s\+\(case\|type\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
"First continuation line
if prevstat =~ '&\s*$' && prev2stat !~ '&\s*$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
"Line after last continuation line
if prevstat !~ '&\s*$' && prev2stat =~ '&\s*$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/framescript.vim
--- a/runtime/indent/framescript.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/framescript.vim Fri Oct 05 13:11:27 2012 -0700
@@ -30,11 +30,11 @@
let ind = indent(lnum)
if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/gitconfig.vim
--- a/runtime/indent/gitconfig.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/gitconfig.vim Fri Oct 05 13:11:27 2012 -0700
@@ -24,13 +24,13 @@
let cline = getline(v:lnum)
if line =~ '\\\@<!\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
- return 2 * &sw
+ return 2 * indent()
elseif cline =~ '^\s*\['
return 0
elseif cline =~ '^\s*\a'
- return &sw
+ return indent()
elseif cline == '' && line =~ '^\['
- return &sw
+ return indent()
else
return -1
endif
diff -r 0769b84adf93 runtime/indent/gitolite.vim
--- a/runtime/indent/gitolite.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/gitolite.vim Fri Oct 05 13:11:27 2012 -0700
@@ -27,11 +27,11 @@
let cline = getline(v:lnum)
if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
- return &sw
+ return indent()
elseif cline =~ '^\s*config\s'
- return &sw
+ return indent()
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
- return &sw
+ return indent()
elseif cline =~ '^\s*#'
return indent(prevln)
elseif cline =~ '^\s*$'
diff -r 0769b84adf93 runtime/indent/haml.vim
--- a/runtime/indent/haml.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/haml.vim Fri Oct 05 13:11:27 2012 -0700
@@ -38,9 +38,9 @@
let indent = indent(lnum)
let cindent = indent(v:lnum)
if cline =~# '\v^-\s*%(elsif|else|when)>'
- let indent = cindent < indent ? cindent : indent - &sw
+ let indent = cindent < indent ? cindent : indent - indent()
endif
- let increase = indent + &sw
+ let increase = indent + indent()
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
diff -r 0769b84adf93 runtime/indent/hamster.vim
--- a/runtime/indent/hamster.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/hamster.vim Fri Oct 05 13:11:27 2012 -0700
@@ -27,13 +27,13 @@
" Add a shiftwidth to statements following if, else, elseif,
" case, select, default, do, until, while, for, start
if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Subtract a shiftwidth from else, elseif, end(if|while|for), until
let line = getline(v:lnum)
if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/html.vim
--- a/runtime/indent/html.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/html.vim Fri Oct 05 13:11:27 2012 -0700
@@ -233,7 +233,7 @@
setlocal noic
endif
- return indent(lnum) + (&sw * ind)
+ return indent(lnum) + (indent() * ind)
endfun
let &cpo = s:cpo_save
diff -r 0769b84adf93 runtime/indent/idlang.vim
--- a/runtime/indent/idlang.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/idlang.vim Fri Oct 05 13:11:27 2012 -0700
@@ -34,25 +34,25 @@
" Indenting of continued lines.
if getline(pnum) =~ '\$\s*\(;.*\)\=$'
if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
- let curind = curind+&sw
+ let curind = curind+indent()
endif
else
if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
- let curind = curind-&sw
+ let curind = curind-indent()
endif
endif
" Indenting blocks of statements.
if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>'
if getline(pnum) =~? 'begin\>'
- elseif indent(v:lnum) > curind-&sw
- let curind = curind-&sw
+ elseif indent(v:lnum) > curind-indent()
+ let curind = curind-indent()
else
return -1
endif
elseif getline(pnum) =~? 'begin\>'
- if indent(v:lnum) < curind+&sw
- let curind = curind+&sw
+ if indent(v:lnum) < curind+indent()
+ let curind = curind+indent()
else
return -1
endif
diff -r 0769b84adf93 runtime/indent/ishd.vim
--- a/runtime/indent/ishd.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/ishd.vim Fri Oct 05 13:11:27 2012 -0700
@@ -50,17 +50,17 @@
" Add
if previous_line =~ '^\s*\<\(function\|begin\|switch\|case\|default\|if.\{-}then\|else\|elseif\|while\|repeat\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Subtract
if this_line =~ '^\s*\<endswitch\>'
- let ind = ind - 2 * &sw
+ let ind = ind - 2 * indent()
elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
elseif this_line =~ '^\s*\<\(case\|default\)\>'
if previous_line !~ '^\s*\<switch\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
diff -r 0769b84adf93 runtime/indent/java.vim
--- a/runtime/indent/java.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/java.vim Fri Oct 05 13:11:27 2012 -0700
@@ -87,7 +87,7 @@
" classes.
if getline(v:lnum) =~ '^\s*\(extends\|implements\)\>'
\ && getline(lnum) !~ '^\s*\(extends\|implements\)\>'
- let theIndent = theIndent + &sw
+ let theIndent = theIndent + indent()
endif
" correct for continuation lines of "throws", "implements" and "extends"
@@ -96,20 +96,20 @@
if strlen(cont_kw) > 0
let amount = strlen(cont_kw) + 1
if getline(lnum) !~ ',\s*$'
- let theIndent = theIndent - (amount + &sw)
+ let theIndent = theIndent - (amount + indent())
if theIndent < 0
let theIndent = 0
endif
elseif prev == lnum
let theIndent = theIndent + amount
if cont_kw ==# 'throws'
- let theIndent = theIndent + &sw
+ let theIndent = theIndent + indent()
endif
endif
elseif getline(prev) =~ '^\s*\(throws\|implements\|extends\)\>'
\ && (getline(prev) =~ '{\s*$'
\ || getline(v:lnum) =~ '^\s*{\s*$')
- let theIndent = theIndent - &sw
+ let theIndent = theIndent - indent()
endif
" When the line starts with a }, try aligning it with the matching {,
diff -r 0769b84adf93 runtime/indent/ld.vim
--- a/runtime/indent/ld.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/ld.vim Fri Oct 05 13:11:27 2012 -0700
@@ -65,7 +65,7 @@
if line =~ '^\s*\*'
return cindent(v:lnum)
elseif line =~ '^\s*}'
- return indent(v:lnum) - &sw
+ return indent(v:lnum) - indent()
endif
let pnum = s:prevnonblanknoncomment(v:lnum - 1)
@@ -73,11 +73,11 @@
return 0
endif
- let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw
+ let ind = indent(pnum) + s:count_braces(pnum, 1) * indent()
let pline = getline(pnum)
if pline =~ '}\s*$'
- let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw
+ let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/liquid.vim
--- a/runtime/indent/liquid.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/liquid.vim Fri Oct 05 13:11:27 2012 -0700
@@ -54,9 +54,9 @@
let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
- let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
- let ind -= &sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
- let ind -= &sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
- let ind -= &sw * s:count(cline,'{%\s*end\w*$')
+ let ind += indent() * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
+ let ind -= indent() * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
+ let ind -= indent() * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
+ let ind -= indent() * s:count(cline,'{%\s*end\w*$')
return ind
endfunction
diff -r 0769b84adf93 runtime/indent/logtalk.vim
--- a/runtime/indent/logtalk.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/logtalk.vim Fri Oct 05 13:11:27 2012 -0700
@@ -38,24 +38,24 @@
endif
" Check for entity opening directive on previous line
if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
- let ind = ind + &sw
+ let ind = ind + indent()
" Check for clause head on previous line
elseif pline =~ ':-\s*\(%.*\)\?$'
- let ind = ind + &sw
+ let ind = ind + indent()
" Check for entity closing directive on previous line
elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
- let ind = ind - &sw
+ let ind = ind - indent()
" Check for end of clause on previous line
elseif pline =~ '\.\s*\(%.*\)\?$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Check for opening conditional on previous line
if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Check for closing an unclosed paren, or middle ; or ->
if line =~ '^\s*\([);]\|->\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
endfunction
diff -r 0769b84adf93 runtime/indent/lua.vim
--- a/runtime/indent/lua.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/lua.vim Fri Oct 05 13:11:27 2012 -0700
@@ -48,7 +48,7 @@
" Add 'shiftwidth' if what we found previously is not in a comment and
" an "end" or "until" is not present on the same line.
if synIDattr(synID(prevlnum, midx + 1, 1), "name") != "luaComment" && prevline !~ '\<end\>\|\<until\>'
- let ind = ind + &shiftwidth
+ let ind = ind + indent()
endif
endif
@@ -56,7 +56,7 @@
" This is the part that requires 'indentkeys'.
let midx = match(getline(v:lnum), '^\s*\%(end\|else\|until\|}\)')
if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment"
- let ind = ind - &shiftwidth
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/make.vim
--- a/runtime/indent/make.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/make.vim Fri Oct 05 13:11:27 2012 -0700
@@ -48,14 +48,14 @@
if prev_prev_line =~ s:continuation_rx
return indent(prev_lnum)
elseif prev_line =~ s:rule_rx
- return &sw
+ return indent()
elseif prev_line =~ s:assignment_rx
call cursor(prev_lnum, 1)
if search(s:assignment_rx, 'W') != 0
return virtcol('.') - 1
else
" TODO: ?
- return &sw
+ return indent()
endif
else
" TODO: OK, this might be a continued shell command, so perhaps indent
@@ -66,7 +66,7 @@
" return indent(prev_lnum) + 2
" endif
"endif
- return indent(prev_lnum) + &sw
+ return indent(prev_lnum) + indent()
endif
elseif prev_prev_line =~ s:continuation_rx
let folded_line = s:remove_continuation(prev_prev_line) . ' ' . s:remove_continuation(prev_line)
@@ -102,13 +102,13 @@
return &ts
endif
elseif prev_line =~ s:conditional_directive_rx
- return &sw
+ return indent()
else
let line = getline(v:lnum)
if line =~ s:just_inserted_rule_rx
return 0
elseif line =~ s:end_conditional_directive_rx
- return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - &sw
+ return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - indent()
else
return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1)
endif
diff -r 0769b84adf93 runtime/indent/matlab.vim
--- a/runtime/indent/matlab.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/matlab.vim Fri Oct 05 13:11:27 2012 -0700
@@ -44,9 +44,9 @@
" See if this line does not follow the line right after an openblock
if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
" See if the user has already dedented
- elseif indent(v:lnum) > curind - &sw
+ elseif indent(v:lnum) > curind - indent()
" If not, recommend one dedent
- let curind = curind - &sw
+ let curind = curind - indent()
else
" Otherwise, trust the user
return -1
@@ -56,9 +56,9 @@
" If the previous line opened a block
elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
" See if the user has already indented
- if indent(v:lnum) < curind + &sw
+ if indent(v:lnum) < curind + indent()
"If not, recommend indent
- let curind = curind + &sw
+ let curind = curind + indent()
else
" Otherwise, trust the user
return -1
diff -r 0769b84adf93 runtime/indent/mma.vim
--- a/runtime/indent/mma.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/mma.vim Fri Oct 05 13:11:27 2012 -0700
@@ -49,7 +49,7 @@
" also, indent only if this line if this line isn't starting a new
" block... TODO - fix this with indentkeys?
if getline(v:lnum-1) =~ '\\\@<!\%(\[[^\]]*\|([^)]*\|{[^}]*\)$' && getline(v:lnum) !~ '\s\+[\[({]'
- let ind = ind+&sw
+ let ind = ind+indent()
endif
" if this line had unmatched closing block,
diff -r 0769b84adf93 runtime/indent/mp.vim
--- a/runtime/indent/mp.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/mp.vim Fri Oct 05 13:11:27 2012 -0700
@@ -162,18 +162,18 @@
" if it is an internal/external :for or :if statements {{{2
let pnn_s = getline(MetaPrevNonblankNoncomment(cl-1))
if pnn_s =~ '\<\(for\|if\)\>.\+:\s*\($\|%\)'
- let ind = match(pnn_s, '\<\(for\|if\)\>.\+:\s*\($\|%\)') + &sw
+ let ind = match(pnn_s, '\<\(for\|if\)\>.\+:\s*\($\|%\)') + indent()
" }}}
" if it is a :def, :vardef, :beginfig, :begingroup, :else, :elseif {{{2
elseif pnn_s =~ '^\s*\(' .
\ '\(var\)\=def\|' .
\ 'begin\(group\|fig\s*(\s*\d\+\s*)\)\|' .
\ 'else\(if\)\=' . '\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
" }}}
" if it is a broken line {{{2
elseif pnn_s !~ end_of_item.'\s*\($\|%\)'
- let ind = ind + (2 * &sw)
+ let ind = ind + (2 * indent())
endif
" }}}
" }}}
@@ -196,7 +196,7 @@
" }}}
" if this is :endgroup statement {{{2
elseif cs =~ '^\s*endgroup\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" }}}
" }}}
diff -r 0769b84adf93 runtime/indent/ocaml.vim
--- a/runtime/indent/ocaml.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/ocaml.vim Fri Oct 05 13:11:27 2012 -0700
@@ -95,7 +95,7 @@
" Return double 'shiftwidth' after lines matching:
if lline =~ '^\s*|.*->\s*$'
- return ind + &sw + &sw
+ return ind + indent() + indent()
endif
let line = getline(v:lnum)
@@ -166,7 +166,7 @@
" Indent if current line begins with 'and':
elseif line =~ '^\s*and\>'
if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$'
- return ind - &sw
+ return ind - indent()
endif
" Indent if current line begins with 'with':
@@ -193,14 +193,14 @@
" or 'method':
elseif line =~ '^\s*\(constraint\|inherit\|initializer\|method\)\>'
if lline !~ s:obj
- return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + &sw
+ return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + indent()
endif
endif
" Add a 'shiftwidth' after lines ending with:
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
- let ind = ind + &sw
+ let ind = ind + indent()
" Back to normal indent after lines ending with ';;':
elseif lline =~ ';;\s*$' && lline !~ '^\s*;;'
@@ -257,7 +257,7 @@
" Subtract a 'shiftwidth' after lines matching 'match ... with parser':
if lline =~ '\<match\>.*\<with\>\s*\<parser\s*$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/occam.vim
--- a/runtime/indent/occam.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/occam.vim Fri Oct 05 13:11:27 2012 -0700
@@ -131,7 +131,7 @@
if line =~ s:FirstLevelIndent || (line =~ s:FirstLevelNonColonEndIndent && line !~ s:ColonEnd)
\ || (line !~ s:ColonStart && (prevline =~ s:SecondLevelIndent
\ || (prevline =~ s:SecondLevelNonColonEndIndent && prevline !~ s:ColonEnd)))
- let curindent = curindent + &shiftwidth
+ let curindent = curindent + indent()
" Restore magic
if !save_magic|setlocal nomagic|endif
@@ -153,7 +153,7 @@
while !found
- if indent(prevlinenum) == curindent - &shiftwidth
+ if indent(prevlinenum) == curindent - indent()
let found = 1
endif
@@ -171,7 +171,7 @@
if prevlinenum > 0
if getline(prevlinenum) =~ s:SecondLevelIndent
- let curindent = curindent + &shiftwidth
+ let curindent = curindent + indent()
endif
endif
diff -r 0769b84adf93 runtime/indent/pascal.vim
--- a/runtime/indent/pascal.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/pascal.vim Fri Oct 05 13:11:27 2012 -0700
@@ -102,12 +102,12 @@
" If the PREVIOUS LINE ended in these items, always indent
if prev_codeline =~ '\<\(type\|const\|var\)$'
- return indnt + &shiftwidth
+ return indnt + indent()
endif
if prev_codeline =~ '\<repeat$'
if this_codeline !~ '^\s*until\>'
- return indnt + &shiftwidth
+ return indnt + indent()
else
return indnt
endif
@@ -115,7 +115,7 @@
if prev_codeline =~ '\<\(begin\|record\)$'
if this_codeline !~ '^\s*end\>'
- return indnt + &shiftwidth
+ return indnt + indent()
else
return indnt
endif
@@ -125,10 +125,10 @@
" followed by "begin"
if prev_codeline =~ '\<\(\|else\|then\|do\)$' || prev_codeline =~ ':$'
if this_codeline !~ '^\s*begin\>'
- return indnt + &shiftwidth
+ return indnt + indent()
else
" If it does start with "begin" then keep the same indent
- "return indnt + &shiftwidth
+ "return indnt + indent()
return indnt
endif
endif
@@ -137,7 +137,7 @@
" only the line before the current one. TODO: Get it working for
" parameter lists longer than two lines.
if prev_codeline =~ '([^)]\+$'
- return indnt + &shiftwidth
+ return indnt + indent()
endif
@@ -146,7 +146,7 @@
" Lines starting with "else", but not following line ending with
" "end".
if this_codeline =~ '^\s*else\>' && prev_codeline !~ '\<end$'
- return indnt - &shiftwidth
+ return indnt - indent()
endif
" Lines after a single-statement branch/loop.
@@ -160,16 +160,16 @@
" additional unindentation.
if this_codeline =~ '^\s*\(end;\|except\|finally\|\)$'
" Note that we don't return from here.
- return indnt - &shiftwidth - &shiftwidth
+ return indnt - indent() - indent()
endif
- return indnt - &shiftwidth
+ return indnt - indent()
endif
" Lines starting with "until" or "end". This rule must be overridden
" by the one for "end" after a single-statement branch/loop. In
" other words that rule should come before this one.
if this_codeline =~ '^\s*\(end\|until\)\>'
- return indnt - &shiftwidth
+ return indnt - indent()
endif
@@ -201,7 +201,7 @@
" If the PREVIOUS LINE ended in these items, always indent.
if prev_codeline =~ '^\s*\(unit\|uses\|try\|except\|finally\|private\|protected\|public\|published\)$'
- return indnt + &shiftwidth
+ return indnt + indent()
endif
" ???? Indent "procedure" and "functions" if they appear within an
@@ -212,11 +212,11 @@
" UNINDENT ONCE
if this_codeline =~ '^\s*\(except\|finally\)$'
- return indnt - &shiftwidth
+ return indnt - indent()
endif
if this_codeline =~ '^\s*\(private\|protected\|public\|published\)$'
- return indnt - &shiftwidth
+ return indnt - indent()
endif
diff -r 0769b84adf93 runtime/indent/perl.vim
--- a/runtime/indent/perl.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/perl.vim Fri Oct 05 13:11:27 2012 -0700
@@ -136,9 +136,9 @@
\ || synid =~ '^perl\(Sub\|Block\)Fold'
let brace = strpart(line, bracepos, 1)
if brace == '(' || brace == '{' || brace == '['
- let ind = ind + &sw
+ let ind = ind + indent()
else
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
let bracepos = match(line, '[(){}\[\]]', bracepos + 1)
@@ -149,25 +149,25 @@
if synid == ""
\ || synid == "perlMatchStartEnd"
\ || synid =~ '^perl\(Sub\|Block\)Fold'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
else
if line =~ '[{\[(]\s*\(#[^)}\]]*\)\=$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if cline =~ '^\s*[)}\]]'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
" Indent lines that begin with 'or' or 'and'
if cline =~ '^\s*\(or\|and\)\>'
if line !~ '^\s*\(or\|and\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
elseif line =~ '^\s*\(or\|and\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/perl6.vim
--- a/runtime/indent/perl6.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/perl6.vim Fri Oct 05 13:11:27 2012 -0700
@@ -111,19 +111,19 @@
endif
if line =~ '[<?\[{(]\s*\(#[^)}\]?>]*\)\=$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if cline =~ '^\s*[)}\]?>]'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Indent lines that begin with 'or' or 'and'
if cline =~ '^\s*\(or\|and\)\>'
if line !~ '^\s*\(or\|and\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
elseif line =~ '^\s*\(or\|and\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/php.vim
--- a/runtime/indent/php.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/php.vim Fri Oct 05 13:11:27 2012 -0700
@@ -51,7 +51,7 @@
if exists("PHP_default_indenting")
- let b:PHP_default_indenting = PHP_default_indenting * &sw
+ let b:PHP_default_indenting = PHP_default_indenting * indent()
else
let b:PHP_default_indenting = 0
endif
@@ -270,7 +270,7 @@
let test = GetLastRealCodeLNum(a:lnum - 1)
if test <= 1
- return indent(1) - &sw * b:PHP_vintage_case_default_indent
+ return indent(1) - indent() * b:PHP_vintage_case_default_indent
end
if getline(test) =~ '^\s*}'
@@ -284,7 +284,7 @@
if getline(test) =~# '^\s*switch\>'
return indent(test)
elseif getline(test) =~# s:defaultORcase
- return indent(test) - &sw * b:PHP_vintage_case_default_indent
+ return indent(test) - indent() * b:PHP_vintage_case_default_indent
else
return FindTheSwitchIndent(test)
endif
@@ -353,7 +353,7 @@
endif
if b:PHP_default_indenting
- let b:PHP_default_indenting = g:PHP_default_indenting * &sw
+ let b:PHP_default_indenting = g:PHP_default_indenting * indent()
endif
let cline = getline(v:lnum)
@@ -595,7 +595,7 @@
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
return indent(FindTheIfOfAnElse(v:lnum, 1))
elseif cline =~# s:defaultORcase
- return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent
+ return FindTheSwitchIndent(v:lnum) + indent() * b:PHP_vintage_case_default_indent
elseif cline =~ '^\s*)\=\s*{'
let previous_line = last_line
let last_line_num = lnum
@@ -607,7 +607,7 @@
let ind = indent(last_line_num)
if b:PHP_BracesAtCodeLevel
- let ind = ind + &sw
+ let ind = ind + indent()
endif
return ind
@@ -618,7 +618,7 @@
endwhile
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
- let ind = ind + &sw
+ let ind = ind + indent()
return ind
elseif (ind != b:PHP_default_indenting || last_line =~ '^)' ) && last_line =~ terminated
@@ -696,7 +696,7 @@
if last_line =~# '[{(]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
@@ -714,18 +714,18 @@
endif
elseif last_line =~ '^\s*'.s:blockstart
- let ind = ind + &sw
+ let ind = ind + indent()
elseif AntepenultimateLine =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
if cline =~ '^\s*);\='
- let ind = ind - &sw
+ let ind = ind - indent()
endif
let b:PHP_CurrentIndentLevel = ind
diff -r 0769b84adf93 runtime/indent/postscr.vim
--- a/runtime/indent/postscr.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/postscr.vim Fri Oct 05 13:11:27 2012 -0700
@@ -41,16 +41,16 @@
" Indent for dicts, arrays, and saves with possible trailing comment
if pline =~ '\(begin\|<<\|g\=save\|{\|[\)\s*\(%.*\)\=$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Remove indent for popped dicts, and restores.
if pline =~ '\(end\|g\=restore\)\s*$'
- let ind = ind - &sw
+ let ind = ind - indent()
" Else handle immediate dedents of dicts, restores, and arrays.
elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)'
- let ind = ind - &sw
+ let ind = ind - indent()
" Else handle DSC comments - always start of line.
elseif getline(a:lnum) =~ '^\s*%%'
diff -r 0769b84adf93 runtime/indent/pov.vim
--- a/runtime/indent/pov.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/pov.vim Fri Oct 05 13:11:27 2012 -0700
@@ -75,9 +75,9 @@
" opening line.
let cur = s:MatchCount(v:lnum, '^\s*\%(#\s*\%(end\|else\)\>\|[]})]\)')
if cur > 0
- let final = plind + (chg - cur) * &sw
+ let final = plind + (chg - cur) * indent()
else
- let final = plind + chg * &sw
+ let final = plind + chg * indent()
endif
return final < 0 ? 0 : final
diff -r 0769b84adf93 runtime/indent/prolog.vim
--- a/runtime/indent/prolog.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/prolog.vim Fri Oct 05 13:11:27 2012 -0700
@@ -41,18 +41,18 @@
endif
" Check for clause head on previous line
if pline =~ ':-\s*\(%.*\)\?$'
- let ind = ind + &sw
+ let ind = ind + indent()
" Check for end of clause on previous line
elseif pline =~ '\.\s*\(%.*\)\?$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Check for opening conditional on previous line
if pline =~ '^\s*\([(;]\|->\)'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Check for closing an unclosed paren, or middle ; or ->
if line =~ '^\s*\([);]\|->\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
endfunction
diff -r 0769b84adf93 runtime/indent/python.vim
--- a/runtime/indent/python.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/python.vim Fri Oct 05 13:11:27 2012 -0700
@@ -36,7 +36,7 @@
if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$'
return indent(a:lnum - 1)
endif
- return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (&sw * 2))
+ return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (indent() * 2))
endif
" If the start of the line is in a string don't change the indent.
@@ -89,9 +89,9 @@
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|String\\)$'")
if pp > 0
- return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : &sw)
+ return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : indent())
endif
- return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (&sw * 2))
+ return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (indent() * 2))
endif
if plnumstart == p
return indent(plnum)
@@ -134,15 +134,15 @@
" If the previous line ended with a colon, indent this line
if pline =~ ':\s*$'
- return plindent + &sw
+ return plindent + indent()
endif
" If the previous line was a stop-execution statement...
if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
" See if the user has already dedented
- if indent(a:lnum) > indent(plnum) - &sw
+ if indent(a:lnum) > indent(plnum) - indent()
" If not, recommend one dedent
- return indent(plnum) - &sw
+ return indent(plnum) - indent()
endif
" Otherwise, trust the user
return -1
@@ -173,11 +173,11 @@
endif
" Or the user has already dedented
- if indent(a:lnum) <= plindent - &sw
+ if indent(a:lnum) <= plindent - indent()
return -1
endif
- return plindent - &sw
+ return plindent - indent()
endif
" When after a () construct we probably want to go back to the start line.
diff -r 0769b84adf93 runtime/indent/r.vim
--- a/runtime/indent/r.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/r.vim Fri Oct 05 13:11:27 2012 -0700
@@ -268,7 +268,7 @@
let nlnum = s:Get_prev_line(nlnum)
let nline = SanitizeRLine(getline(nlnum)) . nline
endwhile
- if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw
+ if nline =~ '^\s*function\s*(' && indent(nlnum) == indent()
return 0
endif
endif
@@ -279,7 +279,7 @@
" line is an incomplete command:
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$'
- return indent(lnum) + &sw
+ return indent(lnum) + indent()
endif
" Deal with () and []
@@ -287,7 +287,7 @@
let pb = s:Get_paren_balance(line, '(', ')')
if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$'))
- return indent(lnum) + &sw
+ return indent(lnum) + indent()
endif
let bb = s:Get_paren_balance(line, '[', ']')
@@ -360,7 +360,7 @@
let line = linepiece . line
endwhile
if line =~ '{$' && post_block == 0
- return indent(lnum) + &sw
+ return indent(lnum) + indent()
endif
" Now we can do some tests again
@@ -370,19 +370,19 @@
if post_block == 0
let newl = SanitizeRLine(line)
if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\<else$' || newl =~ '<-$'
- return indent(lnum) + &sw
+ return indent(lnum) + indent()
endif
endif
endif
if cline =~ '^\s*else'
if line =~ '<-\s*if\s*()'
- return indent(lnum) + &sw
+ return indent(lnum) + indent()
else
if line =~ '\<if\s*()'
return indent(lnum)
else
- return indent(lnum) - &sw
+ return indent(lnum) - indent()
endif
endif
endif
@@ -451,16 +451,16 @@
let pind = indent(plnum)
if g:r_indent_align_args == 0 && pb != 0
- let ind += pb * &sw
+ let ind += pb * indent()
return ind
endif
if g:r_indent_align_args == 0 && bb != 0
- let ind += bb * &sw
+ let ind += bb * indent()
return ind
endif
- if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
+ if ind == pind || (ind == (pind + indent()) && pline =~ '{$' && ppost_else == 0)
return ind
endif
@@ -480,7 +480,7 @@
let pbb = s:Get_paren_balance(pline, '[', ']')
endwhile
let pind = indent(plnum)
- if ind == (pind + &sw) && pline =~ '{$'
+ if ind == (pind + indent()) && pline =~ '{$'
return ind
endif
endwhile
diff -r 0769b84adf93 runtime/indent/readline.vim
--- a/runtime/indent/readline.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/readline.vim Fri Oct 05 13:11:27 2012 -0700
@@ -25,11 +25,11 @@
let ind = indent(lnum)
if getline(lnum) =~ '^\s*$\(if\|else\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/rpl.vim
--- a/runtime/indent/rpl.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/rpl.vim Fri Oct 05 13:11:27 2012 -0700
@@ -32,16 +32,16 @@
if prevstat =~? '\<\(if\|iferr\|do\|while\)\>' && prevstat =~? '\<end\>'
elseif prevstat =~? '\(^\|\s\+\)<<\($\|\s\+\)' && prevstat =~? '\s\+>>\($\|\s\+\)'
elseif prevstat =~? '\<\(if\|iferr\|then\|else\|elseif\|select\|case\|do\|until\|while\|repeat\|for\|start\|default\)\>' || prevstat =~? '\(^\|\s\+\)<<\($\|\s\+\)'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Subtract a shiftwidth from then, else, elseif, end, until, repeat, next,
" step
let line = getline(v:lnum)
if line =~? '^\s*\(then\|else\|elseif\|until\|repeat\|next\|step\|default\|end\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
elseif line =~? '^\s*>>\($\|\s\+\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/ruby.vim
--- a/runtime/indent/ruby.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/ruby.vim Fri Oct 05 13:11:27 2012 -0700
@@ -275,7 +275,7 @@
" If the previous line ended with a block opening, add a level of indent.
if s:Match(lnum, s:block_regex)
- return indent(s:GetMSL(lnum)) + &sw
+ return indent(s:GetMSL(lnum)) + indent()
endif
" If the previous line contained an opening bracket, and we are still in it,
@@ -284,12 +284,12 @@
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
- return ind + &sw
+ return ind + indent()
else
return virtcol('.')
endif
elseif counts[1] == '1' || counts[2] == '1'
- return ind + &sw
+ return ind + indent()
else
call cursor(v:lnum, vcol)
end
@@ -315,8 +315,8 @@
let col = s:Match(lnum, s:ruby_indent_keywords)
if col > 0
call cursor(lnum, col)
- let ind = virtcol('.') - 1 + &sw
-" let ind = indent(lnum) + &sw
+ let ind = virtcol('.') - 1 + indent()
+" let ind = indent(lnum) + indent()
" TODO: make this better (we need to count them) (or, if a searchpair
" fails, we know that something is lacking an end and thus we indent a
" level
@@ -349,9 +349,9 @@
" TODO: this does not take into account contrived things such as
" module Foo; class Bar; end
if s:Match(lnum, s:ruby_indent_keywords)
- let ind = msl_ind + &sw
+ let ind = msl_ind + indent()
if s:Match(lnum, s:end_end_regex)
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
endif
@@ -359,7 +359,7 @@
" If the previous line ended with [*+/.-=], indent one extra level.
if s:Match(lnum, s:continuation_regex)
if lnum == p_lnum
- let ind = msl_ind + &sw
+ let ind = msl_ind + indent()
else
let ind = msl_ind
endif
diff -r 0769b84adf93 runtime/indent/sass.vim
--- a/runtime/indent/sass.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/sass.vim Fri Oct 05 13:11:27 2012 -0700
@@ -28,9 +28,9 @@
let indent = indent(lnum)
let cindent = indent(v:lnum)
if line !~ s:property && cline =~ s:property
- return indent + &sw
+ return indent + indent()
"elseif line =~ s:property && cline !~ s:property
- "return indent - &sw
+ "return indent - indent()
else
return -1
endif
diff -r 0769b84adf93 runtime/indent/sdl.vim
--- a/runtime/indent/sdl.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/sdl.vim Fri Oct 05 13:11:27 2012 -0700
@@ -46,17 +46,17 @@
if (getline(lnum) =~? '^\s*\(start\|state\|system\|package\|connection\|channel\|alternative\|macro\|operator\|newtype\|select\|substructure\|decision\|generator\|refinement\|service\|method\|exceptionhandler\|asntype\|syntype\|value\|(.*):\|\(priority\s\+\)\=input\|provided\)'
\ || getline(lnum) =~? virtuality . '\(process\|procedure\|block\|object\)')
\ && getline(lnum) !~? 'end[[:alpha:]]\+;$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Subtract a 'shiftwidth' after states
if getline(lnum) =~? '^\s*\(stop\|return\>\|nextstate\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Subtract a 'shiftwidth' on on end (uncompleted line)
if getline(v:lnum) =~? '^\s*end\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Put each alternatives where the corresponding decision was
diff -r 0769b84adf93 runtime/indent/sh.vim
--- a/runtime/indent/sh.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/sh.vim Fri Oct 05 13:11:27 2012 -0700
@@ -22,7 +22,7 @@
set cpo&vim
function s:buffer_shiftwidth()
- return &shiftwidth
+ return indent()
endfunction
let s:sh_indent_defaults = {
diff -r 0769b84adf93 runtime/indent/sml.vim
--- a/runtime/indent/sml.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/sml.vim Fri Oct 05 13:11:27 2012 -0700
@@ -115,9 +115,9 @@
" Return double 'shiftwidth' after lines matching:
if lline =~ '^\s*|.*=>\s*$'
- return ind + &sw + &sw
+ return ind + indent() + indent()
elseif lline =~ '^\s*val\>.*=\s*$'
- return ind + &sw
+ return ind + indent()
endif
let line = getline(v:lnum)
@@ -157,7 +157,7 @@
if lastModule == -1
return 0
else
- return lastModule + &sw
+ return lastModule + indent()
endif
" Indent lines starting with '|' from matching 'case', 'handle'
@@ -172,7 +172,7 @@
if switchLine =~ '\<case\>'
return col(".") + 2
elseif switchLine =~ '\<handle\>'
- return switchLineIndent + &sw
+ return switchLineIndent + indent()
elseif switchLine =~ '\<datatype\>'
call search('=')
return col(".") - 1
@@ -184,7 +184,7 @@
" Indent if last line ends with 'sig', 'struct', 'let', 'then', 'else',
" 'in'
elseif lline =~ '\<\(sig\|struct\|let\|in\|then\|else\)\s*$'
- let ind = ind + &sw
+ let ind = ind + indent()
" Indent if last line ends with 'of', align from 'case'
elseif lline =~ '\<\(of\)\s*$'
@@ -199,14 +199,14 @@
" Indent if last line starts with 'fun', 'case', 'fn'
elseif lline =~ '^\s*\(fun\|fn\|case\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Don't indent 'let' if last line started with 'fun', 'fn'
if line =~ '^\s*let\>'
if lline =~ '^\s*\(fun\|fn\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
diff -r 0769b84adf93 runtime/indent/sqlanywhere.vim
--- a/runtime/indent/sqlanywhere.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/sqlanywhere.vim Fri Oct 05 13:11:27 2012 -0700
@@ -136,7 +136,7 @@
endwhile
" Fallback - just move back one
- " return a:prev_indent - &sw
+ " return a:prev_indent - indent()
return ignore_paran
endfunction
@@ -155,7 +155,7 @@
let lnum = a:curr_lnum
" Default - reduce indent by 1
- let ind = indent(a:curr_lnum) - &sw
+ let ind = indent(a:curr_lnum) - indent()
if a:keyword =~? 'end'
exec 'normal! ^'
@@ -219,7 +219,7 @@
let ind = a:ind
if ind > 0
- let modulo = ind % &shiftwidth
+ let modulo = ind % indent()
if modulo > 0
let ind = ind - modulo
@@ -288,7 +288,7 @@
" where END IF, END, should decrease the indent.
if prevline =~? s:SQLBlockStart
" Move indent in
- let ind = ind + &sw
+ let ind = ind + indent()
" echom 'prevl - SQLBlockStart - indent ' . ind . ' line: ' . prevline
elseif prevline =~ '[()]'
if prevline =~ '('
@@ -305,7 +305,7 @@
if num_unmatched_left > 0
" There is a open left paranethesis
" increase indent
- let ind = ind + ( &sw * num_unmatched_left )
+ let ind = ind + ( indent() * num_unmatched_left )
elseif num_unmatched_right > 0
" if it is an unbalanced paranethesis only unindent if
" it was part of a command (ie create table(..) )
@@ -320,7 +320,7 @@
endif
if (num_unmatched_right - ignore) > 0
- let ind = ind - ( &sw * (num_unmatched_right - ignore) )
+ let ind = ind - ( indent() * (num_unmatched_right - ignore) )
endif
endif
@@ -336,12 +336,12 @@
if line =~? '^\s*els'
" Any line when you type else will automatically back up one
" ident level (ie else, elseif, elsif)
- let ind = ind - &sw
+ let ind = ind - indent()
" echom 'curr - else - indent ' . ind
elseif line =~? '^\s*end\>'
let ind = s:GetStmtStarterIndent('end', v:lnum)
" General case for end
- " let ind = ind - &sw
+ " let ind = ind - indent()
" echom 'curr - end - indent ' . ind
elseif line =~? '^\s*when\>'
let ind = s:GetStmtStarterIndent('when', v:lnum)
@@ -349,7 +349,7 @@
" clause, do not change the indent level, since these
" statements do not have a corresponding END statement.
" if stmt_starter =~? 'case'
- " let ind = ind - &sw
+ " let ind = ind - indent()
" endif
" elseif line =~ '^\s*)\s*;\?\s*$'
" elseif line =~ '^\s*)'
@@ -368,14 +368,14 @@
" let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
" if num_unmatched_right > 0
" elseif strpart( line, strlen(line)-1, 1 ) =~ ')'
- " let ind = ind - &sw
+ " let ind = ind - indent()
if line =~ '^\s*)'
" let ignore = ignore + 1
" echom 'curr - begins ) unbalanced ignore: ' . ignore
endif
if (num_unmatched_right - ignore) > 0
- let ind = ind - ( &sw * (num_unmatched_right - ignore) )
+ let ind = ind - ( indent() * (num_unmatched_right - ignore) )
endif
" endif
endif
diff -r 0769b84adf93 runtime/indent/tcl.vim
--- a/runtime/indent/tcl.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/tcl.vim Fri Oct 05 13:11:27 2012 -0700
@@ -56,7 +56,7 @@
if line =~ '^\s*\*'
return cindent(v:lnum)
elseif line =~ '^\s*}'
- return indent(v:lnum) - &sw
+ return indent(v:lnum) - indent()
endif
let pnum = s:prevnonblanknoncomment(v:lnum - 1)
@@ -64,11 +64,11 @@
return 0
endif
- let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw
+ let ind = indent(pnum) + s:count_braces(pnum, 1) * indent()
let pline = getline(pnum)
if pline =~ '}\s*$'
- let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw
+ let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/tcsh.vim
--- a/runtime/indent/tcsh.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/tcsh.vim Fri Oct 05 13:11:27 2012 -0700
@@ -32,17 +32,17 @@
let ind = indent(lnum)
let line = getline(lnum)
if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(<then|\\)$'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if line =~ '\v^\s*breaksw>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" Subtract indent if current line has on end, endif, case commands
let line = getline(v:lnum)
if line =~ '\v^\s*%(else|end|endif)\s*$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/tex.vim
--- a/runtime/indent/tex.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/tex.vim Fri Oct 05 13:11:27 2012 -0700
@@ -216,12 +216,12 @@
" LH modification : \begin does not always start a line
" ZYC modification : \end after \begin won't cause wrong indent anymore
if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env
- let ind = ind + &sw
+ let ind = ind + indent()
if g:tex_indent_items
" Add another sw for item-environments
if line =~ g:tex_itemize_env
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
endif
@@ -232,11 +232,11 @@
if g:tex_indent_items
" Remove another sw for item-environments
if cline =~ g:tex_itemize_env
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
- let ind = ind - &sw
+ let ind = ind - indent()
endif
if g:tex_indent_brace
@@ -264,7 +264,7 @@
endif
endfor
- let ind += (sum1 - sum2) * &sw
+ let ind += (sum1 - sum2) * indent()
endif
if g:tex_indent_paretheses
@@ -277,12 +277,12 @@
" '\item' or '\bibitem' itself:
if cline =~ g:tex_items
- let ind = ind - &sw
+ let ind = ind - indent()
endif
" lines following to '\item' are intented once again:
if line =~ g:tex_items
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
diff -r 0769b84adf93 runtime/indent/tf.vim
--- a/runtime/indent/tf.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/tf.vim Fri Oct 05 13:11:27 2012 -0700
@@ -38,14 +38,14 @@
endif
if line =~ '\(/def.*\\\|/for.*\(%;\s*\)\@\<!\\\)$'
- let ind = ind + &sw
+ let ind = ind + indent()
elseif line =~ '\(/if\|/else\|/then\)'
if line !~ '/endif'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
elseif line =~ '/while'
if line !~ '/done'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
endif
@@ -53,11 +53,11 @@
if line =~ '\(/else\|/endif\|/then\)'
if line !~ '/if'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
elseif line =~ '/done'
if line !~ '/while'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
diff -r 0769b84adf93 runtime/indent/tilde.vim
--- a/runtime/indent/tilde.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/tilde.vim Fri Oct 05 13:11:27 2012 -0700
@@ -25,11 +25,11 @@
endif
if getline(v:lnum) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>'
- return indent(v:lnum) - &sw
+ return indent(v:lnum) - indent()
endif
if getline(plnum) =~ '^\s*\~\(if\|foreach\|foreach_row\|xml_loop\|file_loop\|file_write\|file_append\|imap_loopsections\|imap_index\|imap_list\|ldap_search\|post_loopall\|post_loop\|file_loop\|sql_loop_num\|sql_dbmsselect\|search\|sql_loop\|post\|for\|function_define\|silent\|while\|setvalbig\|mail_create\|systempipe\|mail_send\|dual\|elseif\|else\)\>'
- return indent(plnum) + &sw
+ return indent(plnum) + indent()
else
return -1
endif
diff -r 0769b84adf93 runtime/indent/treetop.vim
--- a/runtime/indent/treetop.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/treetop.vim Fri Oct 05 13:11:27 2012 -0700
@@ -26,12 +26,12 @@
let line = getline(pnum)
if line =~ '^\s*\%(grammar\|module\|rule\)\>'
- let ind += &sw
+ let ind += indent()
endif
let line = getline(v:lnum)
if line =~ '^\s*end\>'
- let ind -= &sw
+ let ind -= indent()
end
retur ind
diff -r 0769b84adf93 runtime/indent/vb.vim
--- a/runtime/indent/vb.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/vb.vim Fri Oct 05 13:11:27 2012 -0700
@@ -49,26 +49,26 @@
" Add
if previous_line =~? '^\s*\<\(begin\|\%(\%(private\|public\|friend\)\s\+\)\=\%(function\|sub\|property\)\|select\|case\|default\|if\|else\|elseif\|do\|for\|while\|enum\|with\)\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" Subtract
if this_line =~? '^\s*\<end\>\s\+\<select\>'
if previous_line !~? '^\s*\<select\>'
- let ind = ind - 2 * &sw
+ let ind = ind - 2 * indent()
else
" this case is for an empty 'select' -- 'end select'
" (w/o any case statements) like:
"
" select case readwrite
" end select
- let ind = ind - &sw
+ let ind = ind - indent()
endif
elseif this_line =~? '^\s*\<\(end\|else\|elseif\|until\|loop\|next\|wend\)\>'
- let ind = ind - &sw
+ let ind = ind - indent()
elseif this_line =~? '^\s*\<\(case\|default\)\>'
if previous_line !~? '^\s*\<select\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
diff -r 0769b84adf93 runtime/indent/verilog.vim
--- a/runtime/indent/verilog.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/verilog.vim Fri Oct 05 13:11:27 2012 -0700
@@ -38,7 +38,7 @@
if exists('b:verilog_indent_width')
let offset = b:verilog_indent_width
else
- let offset = &sw
+ let offset = indent()
endif
if exists('b:verilog_indent_modules')
let indent_modules = offset
diff -r 0769b84adf93 runtime/indent/vhdl.vim
--- a/runtime/indent/vhdl.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/vhdl.vim Fri Oct 05 13:11:27 2012 -0700
@@ -114,9 +114,9 @@
return ind2 + m
else
if g:vhdl_indent_genportmap
- return ind2 + stridx(prevs_noi, '(') + &sw
+ return ind2 + stridx(prevs_noi, '(') + indent()
else
- return ind2 + &sw
+ return ind2 + indent()
endif
endif
endif
@@ -128,7 +128,7 @@
if g:vhdl_indent_rhsassign
return ind2 + matchend(prevs_noi, '<=\s*\ze.')
else
- return ind2 + &sw
+ return ind2 + indent()
endif
endif
@@ -218,12 +218,12 @@
let ps = getline(pn)
if (ps =~? s:NC.'\<begin\>')
- return indent(pn) - &sw
+ return indent(pn) - indent()
endif
endwhile
if (pn == 0)
- return ind - &sw
+ return ind - indent()
else
return indent(pn)
endif
@@ -237,7 +237,7 @@
" keyword: "type"
let s3 = s:NC.s:NE.'\<type\>'
if curs !~? s3.'.*'.s:NC.'\<\%(record\|units\)\>.*'.s:ES && prevs =~? s3
- let ind = ind + &sw
+ let ind = ind + indent()
endif
return ind
endif
@@ -282,7 +282,7 @@
" removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while"
" where: anywhere in previous line
if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>'
- return ind + &sw
+ return ind + indent()
endif
" indent: +sw
@@ -290,7 +290,7 @@
" removed: "component", "for", "when", "with"
" where: start of previous line
if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>'
- return ind + &sw
+ return ind + indent()
endif
" indent: +sw
@@ -298,7 +298,7 @@
" removed: "generate", "is", "=>"
" where: end of previous line
if prevs =~? s:NC.'\<select'.s:ES
- return ind + &sw
+ return ind + indent()
endif
" indent: +sw
@@ -310,7 +310,7 @@
" where: end of previous line
" _note_: indent allowed to leave this filter
if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(loop\|record\|units\)\>\)' || prevs =~? '^\s*\%(component\|else\|for\)\>' || prevs =~? s:NC.'\%('.s:NE.'\<generate\|\<\%(is\|then\)\|=>\)'.s:ES
- let ind = ind + &sw
+ let ind = ind + indent()
endif
" ****************************************************************************************
@@ -322,7 +322,7 @@
if prevs =~? s:NC.'\<is'.s:ES
return ind
elseif prevs !~? s4
- return ind - &sw
+ return ind - indent()
else
return ind2
endif
@@ -336,7 +336,7 @@
if prevs =~? '^\s*\%(elsif\|'.s5.'\)'
return ind
else
- return ind - &sw
+ return ind - indent()
endif
endif
@@ -367,9 +367,9 @@
"where: start of previous non-comment line
if m == 1
if ps =~? '^\s*end\s\+case\>'
- return indent(pn) - 2 * &sw
+ return indent(pn) - 2 * indent()
elseif ps =~? '^\s*when\>'
- return indent(pn) - &sw
+ return indent(pn) - indent()
elseif ps =~? '^\s*case\>'
return indent(pn)
endif
@@ -385,14 +385,14 @@
let pn = prevnonblank(pn - 1)
let ps = getline(pn)
endwhile
- return ind - &sw
+ return ind - indent()
endif
" indent: -sw
" keyword: ")"
" where: start of current line
if curs =~ '^\s*)'
- return ind - &sw
+ return ind - indent()
endif
" indent: 0
@@ -407,7 +407,7 @@
" where: start of current line
"if curs =~? '^\s*end\s\+\w\+\>'
if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)'
- return ind - &sw
+ return ind - indent()
endif
" ****************************************************************************************
diff -r 0769b84adf93 runtime/indent/vim.vim
--- a/runtime/indent/vim.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/vim.vim Fri Oct 05 13:11:27 2012 -0700
@@ -56,18 +56,18 @@
if exists("g:vim_indent_cont")
let ind = ind + g:vim_indent_cont
else
- let ind = ind + &sw * 3
+ let ind = ind + indent() * 3
endif
elseif getline(lnum) =~ '^\s*aug\%[roup]' && getline(lnum) !~ '^\s*aug\%[roup]\s*!\=\s\+END'
- let ind = ind + &sw
+ let ind = ind + indent()
else
let line = getline(lnum)
let i = match(line, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
if i >= 0
- let ind += &sw
+ let ind += indent()
if strpart(line, i, 1) == '|' && has('syntax_items')
\ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$'
- let ind -= &sw
+ let ind -= indent()
endif
endif
endif
@@ -79,7 +79,7 @@
let i = match(line, '[^\\]|\s*\(ene\@!\)')
if i > 0 && line !~ '^\s*au\%[tocmd]'
if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
endif
@@ -87,7 +87,7 @@
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
" :endfun, :else and :augroup END.
if getline(v:lnum) =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+END\)'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/xf86conf.vim
--- a/runtime/indent/xf86conf.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/xf86conf.vim Fri Oct 05 13:11:27 2012 -0700
@@ -26,11 +26,11 @@
let ind = indent(lnum)
if getline(lnum) =~? '^\s*\(Sub\)\=Section\>'
- let ind = ind + &sw
+ let ind = ind + indent()
endif
if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>'
- let ind = ind - &sw
+ let ind = ind - indent()
endif
return ind
diff -r 0769b84adf93 runtime/indent/xinetd.vim
--- a/runtime/indent/xinetd.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/xinetd.vim Fri Oct 05 13:11:27 2012 -0700
@@ -47,8 +47,8 @@
return 0
endif
- return indent(pnum) + s:count_braces(pnum, 1) * &sw
- \ - s:count_braces(v:lnum, 0) * &sw
+ return indent(pnum) + s:count_braces(pnum, 1) * indent()
+ \ - s:count_braces(v:lnum, 0) * indent()
endfunction
let &cpo = s:keepcpo
diff -r 0769b84adf93 runtime/indent/xml.vim
--- a/runtime/indent/xml.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/xml.vim Fri Oct 05 13:11:27 2012 -0700
@@ -67,7 +67,7 @@
fun! <SID>XmlIndentSum(lnum, style, add)
let line = getline(a:lnum)
if a:style == match(line, '^\s*</')
- return (&sw *
+ return (indent() *
\ (<SID>XmlIndentWithPattern(line, b:xml_indent_open)
\ - <SID>XmlIndentWithPattern(line, b:xml_indent_close)
\ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add
diff -r 0769b84adf93 runtime/indent/zimbu.vim
--- a/runtime/indent/zimbu.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/indent/zimbu.vim Fri Oct 05 13:11:27 2012 -0700
@@ -74,9 +74,9 @@
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|String\\|Char\\)$'")
if pp > 0
- return indent(prevLnum) + &sw
+ return indent(prevLnum) + indent()
endif
- return indent(prevLnum) + &sw * 2
+ return indent(prevLnum) + indent() * 2
endif
if plnumstart == p
return indent(prevLnum)
@@ -102,13 +102,13 @@
endif
if prevline =~ '^\s*\(IF\|\|ELSEIF\|ELSE\|GENERATE_IF\|\|GENERATE_ELSEIF\|GENERATE_ELSE\|WHILE\|REPEAT\|TRY\|CATCH\|FINALLY\|FOR\|DO\|SWITCH\|CASE\|DEFAULT\|FUNC\|VIRTUAL\|ABSTRACT\|DEFINE\|REPLACE\|FINAL\|PROC\|MAIN\|NEW\|ENUM\|CLASS\|INTERFACE\|BITS\|MODULE\|SHARED\)\>'
- let plindent += &sw
+ let plindent += indent()
endif
if thisline =~ '^\s*\(}\|ELSEIF\>\|ELSE\>\|CATCH\|FINALLY\|GENERATE_ELSEIF\>\|GENERATE_ELSE\>\|UNTIL\>\)'
- let plindent -= &sw
+ let plindent -= indent()
endif
if thisline =~ '^\s*\(CASE\>\|DEFAULT\>\)' && prevline !~ '^\s*SWITCH\>'
- let plindent -= &sw
+ let plindent -= indent()
endif
" line up continued comment that started after some code
diff -r 0769b84adf93 runtime/macros/justify.vim
--- a/runtime/macros/justify.vim Fri Oct 05 21:30:08 2012 +0200
+++ b/runtime/macros/justify.vim Fri Oct 05 13:11:27 2012 -0700
@@ -203,7 +203,7 @@
endwhile
let indent_sw = 0
if a:3 =~ '\(shiftwidth\|sw\)'
- let indent_sw = &sw
+ let indent_sw = indent()
elseif a:3 =~ '\(tabstop\|ts\)'
let indent_sw = &ts
endif
------=_Part_232_3574963.1349467951054--