Skip to content

Instantly share code, notes, and snippets.

@machakann
Created March 17, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machakann/3ddc492f2884d50ad2ba to your computer and use it in GitHub Desktop.
Save machakann/3ddc492f2884d50ad2ba to your computer and use it in GitHub Desktop.
vim-jp/issues #714
diff -r 3bd553b9e4bf runtime/indent/ada.vim
--- a/runtime/indent/ada.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/ada.vim Tue Mar 17 21:55:49 2015 +0800
@@ -87,7 +87,7 @@
endwhile
endwhile
" Fallback - just move back one
- return a:prev_indent - &sw
+ return a:prev_indent - shiftwidth()
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 - shiftwidth()
endfunction EndBlockIndent
" Section: s:StatementIndent {{{1
@@ -213,15 +213,15 @@
endif
" Move indent in
if ! false_match
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
elseif line =~ '^\s*\(case\|exception\)\>'
" Move indent in twice (next 'when' will move back)
- let ind = ind + 2 * &sw
+ let ind = ind + 2 * shiftwidth()
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+shiftwidth(), 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 + shiftwidth()
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 - shiftwidth(), 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 + shiftwidth()
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\>', '' ) + shiftwidth()
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\)\>', '' ) + shiftwidth()
elseif line =~ '^\s*end\>\s*\<if\>'
" End of if statements
let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' )
diff -r 3bd553b9e4bf runtime/indent/awk.vim
--- a/runtime/indent/awk.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/awk.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
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 + shiftwidth()
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 - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/bst.vim
--- a/runtime/indent/bst.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/bst.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth() * s:count(line,'{')
+ let ind = ind - shiftwidth() * s:count(fakeline,'}')
return ind
endfunction
diff -r 3bd553b9e4bf runtime/indent/cdl.vim
--- a/runtime/indent/cdl.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/cdl.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 shiftwidth()
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 shiftwidth()
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 + shiftwidth()
elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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 - shiftwidth()
elseif c == '(' || c ==? 'f' " '(' or 'if'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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 + shiftwidth()
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 - shiftwidth()
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 + shiftwidth()
end
end
diff -r 3bd553b9e4bf runtime/indent/cmake.vim
--- a/runtime/indent/cmake.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/cmake.vim Tue Mar 17 21:55:49 2015 +0800
@@ -68,19 +68,19 @@
let ind = ind
else
if previous_line =~? cmake_indent_begin_regex
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if previous_line =~? cmake_indent_open_regex
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
" Subtract
if this_line =~? cmake_indent_end_regex
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
if previous_line =~? cmake_indent_close_regex
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/cobol.vim
--- a/runtime/indent/cobol.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/cobol.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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) + shiftwidth()
+ "let ind = ind + shiftwidth()
endif
elseif line =~? clauses && cline !~? end
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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 + shiftwidth()
+ let default = lindent + shiftwidth()
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 + shiftwidth()
elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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) + shiftwidth()
endif
elseif line =~? '^WHEN\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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 - shiftwidth()
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 - shiftwidth()
endif
endif
return ind < bshft ? bshft : ind
diff -r 3bd553b9e4bf runtime/indent/css.vim
--- a/runtime/indent/css.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/css.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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) * shiftwidth()
+ \ - s:count_braces(v:lnum, 0) * shiftwidth()
endfunction
let &cpo = s:keepcpo
diff -r 3bd553b9e4bf runtime/indent/cucumber.vim
--- a/runtime/indent/cucumber.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/cucumber.vim Tue Mar 17 21:55:49 2015 +0800
@@ -35,38 +35,38 @@
return 0
elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
" examples heading
- return 2 * &sw
+ return 2 * shiftwidth()
elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
" background, scenario or outline heading
- return &sw
+ return shiftwidth()
elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
" line after feature heading
- return &sw
+ return shiftwidth()
elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
" line after examples heading
- return 3 * &sw
+ return 3 * shiftwidth()
elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
" line after background, scenario or outline heading
- return 2 * &sw
+ return 2 * shiftwidth()
elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
" tag or comment before a feature heading
return 0
elseif cline =~# '^\s*@'
" other tags
- return &sw
+ return shiftwidth()
elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
" mid-table
" preserve indent
return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
" first line of a table, relative indent
- return indent(prevnonblank(v:lnum-1)) + &sw
+ return indent(prevnonblank(v:lnum-1)) + shiftwidth()
elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
" line after a table, relative unindent
- return indent(prevnonblank(v:lnum-1)) - &sw
+ return indent(prevnonblank(v:lnum-1)) - shiftwidth()
elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
" comments on scenarios
- return &sw
+ return shiftwidth()
endif
return indent(prevnonblank(v:lnum-1))
endfunction
diff -r 3bd553b9e4bf runtime/indent/dtd.vim
--- a/runtime/indent/dtd.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/dtd.vim Tue Mar 17 21:55:49 2015 +0800
@@ -84,7 +84,7 @@
let [declaration, end] = s:lex1(line, col)
if declaration == ""
- return indent + &sw
+ return indent + shiftwidth()
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 + shiftwidth()
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 + shiftwidth()
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 + shiftwidth())
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 + shiftwidth()
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 + shiftwidth())
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 + shiftwidth() * 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 + shiftwidth() * 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 + shiftwidth() * 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 + shiftwidth() * 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 + shiftwidth()
elseif name == '%'
let [name, end] = s:lex(line, end)
if name == ""
- return indent + &sw
+ return indent + shiftwidth()
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 + shiftwidth()
elseif value == 'SYSTEM' || value == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)')
if quoted_string == ""
- return indent + &sw * 2
+ return indent + shiftwidth() * 2
endif
if value == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)')
if quoted_string == ""
- return indent + &sw * 2
+ return indent + shiftwidth() * 2
endif
endif
let [ndata, end] = s:lex(line, end)
if ndata == ""
- return indent + &sw
+ return indent + shiftwidth()
endif
let [name, end] = s:lex(line, end)
- return name == "" ? (indent + &sw * 2) : indent
+ return name == "" ? (indent + shiftwidth() * 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 + shiftwidth()
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 + shiftwidth()
elseif id == 'SYSTEM' || id == 'PUBLIC'
let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)')
if quoted_string == ""
- return indent + &sw * 2
+ return indent + shiftwidth() * 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 + shiftwidth() * 2)
elseif quoted_string == '>'
return indent
endif
diff -r 3bd553b9e4bf runtime/indent/dylan.vim
--- a/runtime/indent/dylan.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/dylan.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 = shiftwidth()
" local methods indent the shift-width, plus 6 for the 'local'
elseif prevline =~? '^\s*local'
- let chg = &sw + 6
+ let chg = shiftwidth() + 6
" If previous line was a let with no closing semicolon, indent
elseif prevline =~? '^\s*let.*[^;]\s*$'
- let chg = &sw
+ let chg = shiftwidth()
" 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 = shiftwidth()
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 - shiftwidth()
endif
return ind + chg
diff -r 3bd553b9e4bf runtime/indent/eiffel.vim
--- a/runtime/indent/eiffel.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/eiffel.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
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 = shiftwidth()
endif
" Indent to double indent
if getline(v:lnum) =~ s:inheritance_dent
- let ind = 2 * &sw
+ let ind = 2 * shiftwidth()
endif
" Indent line after the first line of the function definition
if getline(lnum) =~ s:single_dent
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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 - shiftwidth()
endif
" Subtract a shiftwidth for end statements
if getline(v:lnum) =~ '^\s*end\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
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 == shiftwidth()
let ind = 0
endif
diff -r 3bd553b9e4bf runtime/indent/erlang.vim
--- a/runtime/indent/erlang.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/erlang.vim Tue Mar 17 21:55:49 2015 +0800
@@ -669,7 +669,7 @@
call s:Pop(a:stack)
if empty(a:stack)
call s:Log(' Stack is ["when"], so LTI is in a guard -> return')
- return [1, a:stored_vcol + &sw + 2]
+ return [1, a:stored_vcol + shiftwidth() + 2]
else
return [1, s:UnexpectedToken(a:token, a:stack)]
endif
@@ -678,7 +678,7 @@
call s:Pop(a:stack)
if empty(a:stack)
call s:Log(' Stack is ["->"], so LTI is in function body -> return')
- return [1, a:stored_vcol + &sw]
+ return [1, a:stored_vcol + shiftwidth()]
elseif a:stack[0] ==# ';'
call s:Pop(a:stack)
if empty(a:stack)
@@ -797,7 +797,7 @@
elseif token ==# 'begin'
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
- \stored_vcol, 'end', &sw)
+ \stored_vcol, 'end', shiftwidth())
if ret | return res | endif
" case EXPR of BRANCHES end
@@ -848,11 +848,11 @@
elseif stack == ['->']
call s:Log(' LTI is in a branch after ' .
\'"of/receive/after/if/catch" -> return')
- return stored_vcol + &sw
+ return stored_vcol + shiftwidth()
elseif stack == ['when']
call s:Log(' LTI is in a guard after ' .
\'"of/receive/after/if/catch" -> return')
- return stored_vcol + &sw
+ return stored_vcol + shiftwidth()
else
return s:UnexpectedToken(token, stack)
endif
@@ -888,7 +888,7 @@
if empty(stack)
call s:Log(' LTI is in a condition; matching ' .
\'"case/if/try/receive" found')
- let stored_vcol = curr_vcol + &sw
+ let stored_vcol = curr_vcol + shiftwidth()
elseif stack[0] ==# 'align_to_begin_element'
call s:Pop(stack)
let stored_vcol = curr_vcol
@@ -897,23 +897,23 @@
\'"case/if/try/receive" found')
call s:Pop(stack)
call s:Pop(stack)
- let stored_vcol = curr_vcol + &sw
+ let stored_vcol = curr_vcol + shiftwidth()
elseif stack[0] ==# '->'
call s:Log(' LTI is in a branch; matching ' .
\'"case/if/try/receive" found')
call s:Pop(stack)
- let stored_vcol = curr_vcol + 2 * &sw
+ let stored_vcol = curr_vcol + 2 * shiftwidth()
elseif stack[0] ==# 'when'
call s:Log(' LTI is in a guard; matching ' .
\'"case/if/try/receive" found')
call s:Pop(stack)
- let stored_vcol = curr_vcol + 2 * &sw + 2
+ let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
endif
endif
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
- \stored_vcol, 'end', &sw)
+ \stored_vcol, 'end', shiftwidth())
if ret | return res | endif
elseif token ==# 'fun'
@@ -930,7 +930,7 @@
" stack = ['when'] => LTI is in a guard
if empty(stack)
call s:Log(' LTI is in a condition; matching "fun" found')
- let stored_vcol = curr_vcol + &sw
+ let stored_vcol = curr_vcol + shiftwidth()
elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';'
call s:Log(' LTI is in a condition; matching "fun" found')
call s:Pop(stack)
@@ -938,15 +938,15 @@
elseif stack[0] ==# '->'
call s:Log(' LTI is in a branch; matching "fun" found')
call s:Pop(stack)
- let stored_vcol = curr_vcol + 2 * &sw
+ let stored_vcol = curr_vcol + 2 * shiftwidth()
elseif stack[0] ==# 'when'
call s:Log(' LTI is in a guard; matching "fun" found')
call s:Pop(stack)
- let stored_vcol = curr_vcol + 2 * &sw + 2
+ let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
endif
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
- \stored_vcol, 'end', &sw)
+ \stored_vcol, 'end', shiftwidth())
if ret | return res | endif
else
" Pass: we have a function reference (e.g. "fun f/0")
@@ -1220,7 +1220,7 @@
" when A,
" LTI
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
- \stored_vcol, &sw)
+ \stored_vcol, shiftwidth())
if ret | return res | endif
else
" Example:
@@ -1252,7 +1252,7 @@
" If LTI is between an 'after' and the corresponding
" 'end', then let's return
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
- \stored_vcol, &sw)
+ \stored_vcol, shiftwidth())
if ret | return res | endif
endif
diff -r 3bd553b9e4bf runtime/indent/eruby.vim
--- a/runtime/indent/eruby.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/eruby.vim Tue Mar 17 21:55:49 2015 +0800
@@ -57,24 +57,24 @@
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 - shiftwidth()
endif
if line =~# '\S\s*<%[-=]\=\s*\%(}\|end\).\{-\}\s*\%([-=]\=%>\|$\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*[-=]\=%>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
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 + shiftwidth()
endif
if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if line !~# '^\s*<%' && line =~# '%>\s*$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
if cline =~# '^\s*[-=]\=%>\s*$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
endfunction
diff -r 3bd553b9e4bf runtime/indent/eterm.vim
--- a/runtime/indent/eterm.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/eterm.vim Tue Mar 17 21:55:49 2015 +0800
@@ -25,11 +25,11 @@
let ind = indent(lnum)
if getline(lnum) =~ '^\s*begin\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~ '^\s*end\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/falcon.vim
--- a/runtime/indent/falcon.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/falcon.vim Tue Mar 17 21:55:49 2015 +0800
@@ -339,7 +339,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)) + shiftwidth()
endif
" If it contained hanging closing brackets, find the rightmost one, find its
@@ -350,20 +350,20 @@
if opening.pos != -1
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
- return ind + &sw
+ return ind + shiftwidth()
else
return virtcol('.')
endif
else
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
- return nonspace > 0 ? nonspace : ind + &sw
+ return nonspace > 0 ? nonspace : ind + shiftwidth()
endif
elseif closing.pos != -1
call cursor(lnum, closing.pos + 1)
normal! %
if s:Match(line('.'), s:falcon_indent_keywords)
- return indent('.') + &sw
+ return indent('.') + shiftwidth()
else
return indent('.')
endif
@@ -392,7 +392,7 @@
let col = s:Match(lnum, s:falcon_indent_keywords)
if col > 0
call cursor(lnum, col)
- let ind = virtcol('.') - 1 + &sw
+ let ind = virtcol('.') - 1 + shiftwidth()
" 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
@@ -422,9 +422,9 @@
" TODO: this does not take into account contrived things such as
" module Foo; class Bar; end
if s:Match(lnum, s:falcon_indent_keywords)
- let ind = msl_ind + &sw
+ let ind = msl_ind + shiftwidth()
if s:Match(lnum, s:end_end_regex)
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
endif
@@ -433,7 +433,7 @@
" closing bracket, indent one extra level.
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
if lnum == p_lnum
- let ind = msl_ind + &sw
+ let ind = msl_ind + shiftwidth()
else
let ind = msl_ind
endif
diff -r 3bd553b9e4bf runtime/indent/fortran.vim
--- a/runtime/indent/fortran.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/fortran.vim Tue Mar 17 21:55:49 2015 +0800
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77)
" Version: 0.41
-" Last Change: 2015 Jan. 15
+" Last Change: 17-Mar-2015. 15
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: Do :help fortran-indent from Vim
" Credits:
@@ -83,10 +83,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 + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*end\s*do\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -96,14 +96,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 + shiftwidth()
" Remove unwanted indent after logical and arithmetic ifs
if prevstat =~? '\<if\>' && prevstat !~? '\<then\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" Remove unwanted indent after type( statements
if prevstat =~? '^\s*type\s*('
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -116,12 +116,12 @@
\ ||prevstat =~? '^\s*'.prefix.'subroutine\>'
\ ||prevstat =~? '^\s*'.prefix.type.'function\>'
\ ||prevstat =~? '^\s*'.type.prefix.'function\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*contains\>'
\ ||getline(v:lnum)=~? '^\s*end\s*'
\ .'\(function\|subroutine\|module\|program\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -132,23 +132,23 @@
\. '\(else\|else\s*if\|else\s*where\|case\|'
\. 'end\s*\(if\|where\|select\|interface\|'
\. 'type\|forall\|associate\|enum\|block\)\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
" Fix indent for case statement immediately after select
if prevstat =~? '\<select\s\+\(case\|type\)\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
"First continuation line
if prevstat =~ '&\s*$' && prev2stat !~ '&\s*$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if prevstat =~ '&\s*$' && prevstat =~ '\<else\s*if\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
"Line after last continuation line
if prevstat !~ '&\s*$' && prev2stat =~ '&\s*$' && prevstat !~? '\<then\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/framescript.vim
--- a/runtime/indent/framescript.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/framescript.vim Tue Mar 17 21:55:49 2015 +0800
@@ -30,11 +30,11 @@
let ind = indent(lnum)
if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/gitconfig.vim
--- a/runtime/indent/gitconfig.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/gitconfig.vim Tue Mar 17 21:55:49 2015 +0800
@@ -24,13 +24,13 @@
let cline = getline(v:lnum)
if line =~ '\\\@<!\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
- return 2 * &sw
+ return 2 * shiftwidth()
elseif cline =~ '^\s*\['
return 0
elseif cline =~ '^\s*\a'
- return &sw
+ return shiftwidth()
elseif cline == '' && line =~ '^\['
- return &sw
+ return shiftwidth()
else
return -1
endif
diff -r 3bd553b9e4bf runtime/indent/gitolite.vim
--- a/runtime/indent/gitolite.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/gitolite.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 shiftwidth()
elseif cline =~ '^\s*config\s'
- return &sw
+ return shiftwidth()
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
- return &sw
+ return shiftwidth()
elseif cline =~ '^\s*#'
return indent(prevln)
elseif cline =~ '^\s*$'
diff -r 3bd553b9e4bf runtime/indent/haml.vim
--- a/runtime/indent/haml.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/haml.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 - shiftwidth()
endif
- let increase = indent + &sw
+ let increase = indent + shiftwidth()
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
diff -r 3bd553b9e4bf runtime/indent/hamster.vim
--- a/runtime/indent/hamster.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/hamster.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
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 - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/html.vim
--- a/runtime/indent/html.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/html.vim Tue Mar 17 21:55:49 2015 +0800
@@ -287,8 +287,8 @@
func! s:CountITags(text)
"{{{
" Store the result in s:curind and s:nextrel.
- let s:curind = 0 " relative indent steps for current line [unit &sw]:
- let s:nextrel = 0 " relative indent steps for next line [unit &sw]:
+ let s:curind = 0 " relative indent steps for current line [unit shiftwidth()]:
+ let s:nextrel = 0 " relative indent steps for next line [unit shiftwidth()]:
let s:block = 0 " assume starting outside of a block
let s:countonly = 1 " don't change state
call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
@@ -299,8 +299,8 @@
func! s:CountTagsAndState(text)
"{{{
" Store the result in s:curind and s:nextrel. Update b:hi_newstate.block.
- let s:curind = 0 " relative indent steps for current line [unit &sw]:
- let s:nextrel = 0 " relative indent steps for next line [unit &sw]:
+ let s:curind = 0 " relative indent steps for current line [unit shiftwidth()]:
+ let s:nextrel = 0 " relative indent steps for next line [unit shiftwidth()]:
let s:block = b:hi_newstate.block
let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
diff -r 3bd553b9e4bf runtime/indent/idlang.vim
--- a/runtime/indent/idlang.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/idlang.vim Tue Mar 17 21:55:49 2015 +0800
@@ -34,25 +34,25 @@
" Indenting of continued lines.
if getline(pnum) =~ '\$\s*\(;.*\)\=$'
if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
- let curind = curind+&sw
+ let curind = curind+shiftwidth()
endif
else
if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
- let curind = curind-&sw
+ let curind = curind-shiftwidth()
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-shiftwidth()
+ let curind = curind-shiftwidth()
else
return -1
endif
elseif getline(pnum) =~? 'begin\>'
- if indent(v:lnum) < curind+&sw
- let curind = curind+&sw
+ if indent(v:lnum) < curind+shiftwidth()
+ let curind = curind+shiftwidth()
else
return -1
endif
diff -r 3bd553b9e4bf runtime/indent/ishd.vim
--- a/runtime/indent/ishd.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/ishd.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
endif
" Subtract
if this_line =~ '^\s*\<endswitch\>'
- let ind = ind - 2 * &sw
+ let ind = ind - 2 * shiftwidth()
elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
elseif this_line =~ '^\s*\<\(case\|default\)\>'
if previous_line !~ '^\s*\<switch\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
diff -r 3bd553b9e4bf runtime/indent/java.vim
--- a/runtime/indent/java.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/java.vim Tue Mar 17 21:55:49 2015 +0800
@@ -87,7 +87,7 @@
" classes.
if getline(v:lnum) =~ '^\s*\(extends\|implements\)\>'
\ && getline(lnum) !~ '^\s*\(extends\|implements\)\>'
- let theIndent = theIndent + &sw
+ let theIndent = theIndent + shiftwidth()
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 + shiftwidth())
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 + shiftwidth()
endif
endif
elseif getline(prev) =~ '^\s*\(throws\|implements\|extends\)\>'
\ && (getline(prev) =~ '{\s*$'
\ || getline(v:lnum) =~ '^\s*{\s*$')
- let theIndent = theIndent - &sw
+ let theIndent = theIndent - shiftwidth()
endif
" When the line starts with a }, try aligning it with the matching {,
diff -r 3bd553b9e4bf runtime/indent/json.vim
--- a/runtime/indent/json.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/json.vim Tue Mar 17 21:55:49 2015 +0800
@@ -141,7 +141,7 @@
" If the previous line ended with a block opening, add a level of indent.
" if s:Match(lnum, s:block_regex)
- " return indent(lnum) + &sw
+ " return indent(lnum) + shiftwidth()
" endif
" If the previous line contained an opening bracket, and we are still in it,
@@ -149,7 +149,7 @@
if line =~ '[[({]'
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
- return ind + &sw
+ return ind + shiftwidth()
else
call cursor(v:lnum, vcol)
end
diff -r 3bd553b9e4bf runtime/indent/ld.vim
--- a/runtime/indent/ld.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/ld.vim Tue Mar 17 21:55:49 2015 +0800
@@ -65,7 +65,7 @@
if line =~ '^\s*\*'
return cindent(v:lnum)
elseif line =~ '^\s*}'
- return indent(v:lnum) - &sw
+ return indent(v:lnum) - shiftwidth()
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) * shiftwidth()
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)) * shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/liquid.vim
--- a/runtime/indent/liquid.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/liquid.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 += shiftwidth() * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
+ let ind -= shiftwidth() * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
+ let ind -= shiftwidth() * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
+ let ind -= shiftwidth() * s:count(cline,'{%\s*end\w*$')
return ind
endfunction
diff -r 3bd553b9e4bf runtime/indent/logtalk.vim
--- a/runtime/indent/logtalk.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/logtalk.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
" Check for clause head on previous line
elseif pline =~ ':-\s*\(%.*\)\?$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
" Check for entity closing directive on previous line
elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
" Check for end of clause on previous line
elseif pline =~ '\.\s*\(%.*\)\?$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" Check for opening conditional on previous line
if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
" Check for closing an unclosed paren, or middle ; or ->
if line =~ '^\s*\([);]\|->\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
endfunction
diff -r 3bd553b9e4bf runtime/indent/make.vim
--- a/runtime/indent/make.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/make.vim Tue Mar 17 21:55:49 2015 +0800
@@ -48,14 +48,14 @@
if prev_prev_line =~ s:continuation_rx
return indent(prev_lnum)
elseif prev_line =~ s:rule_rx
- return &sw
+ return shiftwidth()
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 shiftwidth()
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) + shiftwidth()
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 shiftwidth()
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) - shiftwidth()
else
return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1)
endif
diff -r 3bd553b9e4bf runtime/indent/matlab.vim
--- a/runtime/indent/matlab.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/matlab.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 - shiftwidth()
" If not, recommend one dedent
- let curind = curind - &sw
+ let curind = curind - shiftwidth()
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 + shiftwidth()
"If not, recommend indent
- let curind = curind + &sw
+ let curind = curind + shiftwidth()
else
" Otherwise, trust the user
return -1
diff -r 3bd553b9e4bf runtime/indent/mma.vim
--- a/runtime/indent/mma.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/mma.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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+shiftwidth()
endif
" if this line had unmatched closing block,
diff -r 3bd553b9e4bf runtime/indent/mp.vim
--- a/runtime/indent/mp.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/mp.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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*\($\|%\)') + shiftwidth()
" }}}
" 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 + shiftwidth()
" }}}
" if it is a broken line {{{2
elseif pnn_s !~ end_of_item.'\s*\($\|%\)'
- let ind = ind + (2 * &sw)
+ let ind = ind + (2 * shiftwidth())
endif
" }}}
" }}}
@@ -196,7 +196,7 @@
" }}}
" if this is :endgroup statement {{{2
elseif cs =~ '^\s*endgroup\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" }}}
" }}}
diff -r 3bd553b9e4bf runtime/indent/ocaml.vim
--- a/runtime/indent/ocaml.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/ocaml.vim Tue Mar 17 21:55:49 2015 +0800
@@ -101,7 +101,7 @@
" Return double 'shiftwidth' after lines matching:
if lline =~ '^\s*|.*->\s*$'
- return ind + &sw + &sw
+ return ind + shiftwidth() + shiftwidth()
endif
let line = getline(v:lnum)
@@ -172,7 +172,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 - shiftwidth()
endif
" Indent if current line begins with 'with':
@@ -199,14 +199,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')) + shiftwidth()
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 + shiftwidth()
" Back to normal indent after lines ending with ';;':
elseif lline =~ ';;\s*$' && lline !~ '^\s*;;'
@@ -263,7 +263,7 @@
" Subtract a 'shiftwidth' after lines matching 'match ... with parser':
if lline =~ '\<match\>.*\<with\>\s*\<parser\s*$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/perl.vim
--- a/runtime/indent/perl.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/perl.vim Tue Mar 17 21:55:49 2015 +0800
@@ -138,9 +138,9 @@
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
let brace = strpart(line, bracepos, 1)
if brace == '(' || brace == '{' || brace == '['
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
else
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
let bracepos = match(line, braceclass, bracepos + 1)
@@ -152,25 +152,25 @@
\ || synid == "perlMatchStartEnd"
\ || synid == "perlBraces"
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
else
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if cline =~ '^\s*[])}]'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
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 + shiftwidth()
endif
elseif line =~ '^\s*\(or\|and\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/perl6.vim
--- a/runtime/indent/perl6.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/perl6.vim Tue Mar 17 21:55:49 2015 +0800
@@ -107,19 +107,19 @@
endif
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if cline =~ '^\s*[)}\]»>]'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
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 + shiftwidth()
endif
elseif line =~ '^\s*\(or\|and\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/php.vim
--- a/runtime/indent/php.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/php.vim Tue Mar 17 21:55:49 2015 +0800
@@ -53,13 +53,13 @@
if exists("PHP_default_indenting")
- let b:PHP_default_indenting = PHP_default_indenting * &sw
+ let b:PHP_default_indenting = PHP_default_indenting * shiftwidth()
else
let b:PHP_default_indenting = 0
endif
if exists("PHP_outdentSLComments")
- let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw
+ let b:PHP_outdentSLComments = PHP_outdentSLComments * shiftwidth()
else
let b:PHP_outdentSLComments = 0
endif
@@ -314,7 +314,7 @@
let test = GetLastRealCodeLNum(a:lnum - 1)
if test <= 1
- return indent(1) - &sw * b:PHP_vintage_case_default_indent
+ return indent(1) - shiftwidth() * b:PHP_vintage_case_default_indent
end
while getline(test) =~ '^\s*}' && test > 1
@@ -328,7 +328,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) - shiftwidth() * b:PHP_vintage_case_default_indent
else
return FindTheSwitchIndent(test)
endif
@@ -401,7 +401,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 * shiftwidth()
endif
let cline = getline(v:lnum)
@@ -660,7 +660,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) + shiftwidth() * b:PHP_vintage_case_default_indent
elseif cline =~ '^\s*)\=\s*{'
let previous_line = last_line
let last_line_num = lnum
@@ -672,7 +672,7 @@
let ind = indent(last_line_num)
if b:PHP_BracesAtCodeLevel
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
return ind
@@ -683,7 +683,7 @@
endwhile
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
return ind + addSpecial
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
@@ -782,7 +782,7 @@
endif
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
@@ -800,17 +800,17 @@
endif
elseif last_line =~ '^\s*'.s:blockstart
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
if cline =~ '^\s*[)\]];\='
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
let b:PHP_CurrentIndentLevel = ind
diff -r 3bd553b9e4bf runtime/indent/postscr.vim
--- a/runtime/indent/postscr.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/postscr.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
endif
" Remove indent for popped dicts, and restores.
if pline =~ '\(end\|g\=restore\)\s*$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
" Else handle immediate dedents of dicts, restores, and arrays.
elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
" Else handle DSC comments - always start of line.
elseif getline(a:lnum) =~ '^\s*%%'
diff -r 3bd553b9e4bf runtime/indent/pov.vim
--- a/runtime/indent/pov.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/pov.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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) * shiftwidth()
else
- let final = plind + chg * &sw
+ let final = plind + chg * shiftwidth()
endif
return final < 0 ? 0 : final
diff -r 3bd553b9e4bf runtime/indent/prolog.vim
--- a/runtime/indent/prolog.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/prolog.vim Tue Mar 17 21:55:49 2015 +0800
@@ -41,18 +41,18 @@
endif
" Check for clause head on previous line
if pline =~ ':-\s*\(%.*\)\?$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
" Check for end of clause on previous line
elseif pline =~ '\.\s*\(%.*\)\?$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" Check for opening conditional on previous line
if pline =~ '^\s*\([(;]\|->\)'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
" Check for closing an unclosed paren, or middle ; or ->
if line =~ '^\s*\([);]\|->\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
endfunction
diff -r 3bd553b9e4bf runtime/indent/r.vim
--- a/runtime/indent/r.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/r.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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) == shiftwidth()
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) + shiftwidth()
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) + shiftwidth()
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) + shiftwidth()
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) + shiftwidth()
endif
endif
endif
if cline =~ '^\s*else'
if line =~ '<-\s*if\s*()'
- return indent(lnum) + &sw
+ return indent(lnum) + shiftwidth()
else
if line =~ '\<if\s*()'
return indent(lnum)
else
- return indent(lnum) - &sw
+ return indent(lnum) - shiftwidth()
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 * shiftwidth()
return ind
endif
if g:r_indent_align_args == 0 && bb != 0
- let ind += bb * &sw
+ let ind += bb * shiftwidth()
return ind
endif
- if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
+ if ind == pind || (ind == (pind + shiftwidth()) && 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 + shiftwidth()) && pline =~ '{$'
return ind
endif
endwhile
diff -r 3bd553b9e4bf runtime/indent/readline.vim
--- a/runtime/indent/readline.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/readline.vim Tue Mar 17 21:55:49 2015 +0800
@@ -25,11 +25,11 @@
let ind = indent(lnum)
if getline(lnum) =~ '^\s*$\(if\|else\)\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/rhelp.vim
--- a/runtime/indent/rhelp.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/rhelp.vim Tue Mar 17 21:55:49 2015 +0800
@@ -85,7 +85,7 @@
let closeb = strlen(line2) - strlen(line3)
let bb = openb - closeb
- let ind = indent(lnum) + (bb * &sw)
+ let ind = indent(lnum) + (bb * shiftwidth())
if line =~ '^\s*}\s*$'
let ind = indent(lnum)
diff -r 3bd553b9e4bf runtime/indent/rpl.vim
--- a/runtime/indent/rpl.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/rpl.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
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 - shiftwidth()
elseif line =~? '^\s*>>\($\|\s\+\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/ruby.vim
--- a/runtime/indent/ruby.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/ruby.vim Tue Mar 17 21:55:49 2015 +0800
@@ -411,12 +411,12 @@
" 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)) + shiftwidth()
endif
" If the previous line ended with the "*" of a splat, add a level of indent
if line =~ s:splat_regex
- return indent(lnum) + &sw
+ return indent(lnum) + shiftwidth()
endif
" If the previous line contained unclosed opening brackets and we are still
@@ -431,20 +431,20 @@
if opening.pos != -1
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
- return ind + &sw
+ return ind + shiftwidth()
else
return virtcol('.')
endif
else
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
- return nonspace > 0 ? nonspace : ind + &sw
+ return nonspace > 0 ? nonspace : ind + shiftwidth()
endif
elseif closing.pos != -1
call cursor(lnum, closing.pos + 1)
normal! %
if s:Match(line('.'), s:ruby_indent_keywords)
- return indent('.') + &sw
+ return indent('.') + shiftwidth()
else
return indent('.')
endif
@@ -473,7 +473,7 @@
let col = s:Match(lnum, s:ruby_indent_keywords)
if col > 0
call cursor(lnum, col)
- let ind = virtcol('.') - 1 + &sw
+ let ind = virtcol('.') - 1 + shiftwidth()
" 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
@@ -506,9 +506,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 + shiftwidth()
if s:Match(lnum, s:end_end_regex)
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
endif
@@ -517,7 +517,7 @@
" closing bracket, indent one extra level.
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
if lnum == p_lnum
- let ind = msl_ind + &sw
+ let ind = msl_ind + shiftwidth()
else
let ind = msl_ind
endif
diff -r 3bd553b9e4bf runtime/indent/sass.vim
--- a/runtime/indent/sass.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/sass.vim Tue Mar 17 21:55:49 2015 +0800
@@ -29,9 +29,9 @@
let indent = indent(lnum)
let cindent = indent(v:lnum)
if line !~ s:property && line !~ s:extend && cline =~ s:property
- return indent + &sw
+ return indent + shiftwidth()
"elseif line =~ s:property && cline !~ s:property
- "return indent - &sw
+ "return indent - shiftwidth()
else
return -1
endif
diff -r 3bd553b9e4bf runtime/indent/sdl.vim
--- a/runtime/indent/sdl.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/sdl.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
endif
" Subtract a 'shiftwidth' after states
if getline(lnum) =~? '^\s*\(stop\|return\>\|nextstate\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" Subtract a 'shiftwidth' on on end (uncompleted line)
if getline(v:lnum) =~? '^\s*end\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" Put each alternatives where the corresponding decision was
diff -r 3bd553b9e4bf runtime/indent/sml.vim
--- a/runtime/indent/sml.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/sml.vim Tue Mar 17 21:55:49 2015 +0800
@@ -115,9 +115,9 @@
" Return double 'shiftwidth' after lines matching:
if lline =~ '^\s*|.*=>\s*$'
- return ind + &sw + &sw
+ return ind + shiftwidth() + shiftwidth()
elseif lline =~ '^\s*val\>.*=\s*$'
- return ind + &sw
+ return ind + shiftwidth()
endif
let line = getline(v:lnum)
@@ -157,7 +157,7 @@
if lastModule == -1
return 0
else
- return lastModule + &sw
+ return lastModule + shiftwidth()
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 + shiftwidth()
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 + shiftwidth()
" 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 + shiftwidth()
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 - shiftwidth()
endif
endif
diff -r 3bd553b9e4bf runtime/indent/sqlanywhere.vim
--- a/runtime/indent/sqlanywhere.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/sqlanywhere.vim Tue Mar 17 21:55:49 2015 +0800
@@ -147,7 +147,7 @@
endwhile
" Fallback - just move back one
- " return a:prev_indent - &sw
+ " return a:prev_indent - shiftwidth()
return ignore_paran
endfunction
@@ -166,7 +166,7 @@
let lnum = a:curr_lnum
" Default - reduce indent by 1
- let ind = indent(a:curr_lnum) - &sw
+ let ind = indent(a:curr_lnum) - shiftwidth()
if a:keyword =~? 'end'
exec 'normal! ^'
@@ -291,7 +291,7 @@
" where END IF, END, should decrease the indent.
if prevline =~? s:SQLBlockStart
" Move indent in
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
" echom 'prevl - SQLBlockStart - indent ' . ind . ' line: ' . prevline
elseif prevline =~ '[()]'
if prevline =~ '('
@@ -308,7 +308,7 @@
if num_unmatched_left > 0
" There is a open left paranethesis
" increase indent
- let ind = ind + ( &sw * num_unmatched_left )
+ let ind = ind + ( shiftwidth() * 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(..) )
@@ -323,7 +323,7 @@
endif
if (num_unmatched_right - ignore) > 0
- let ind = ind - ( &sw * (num_unmatched_right - ignore) )
+ let ind = ind - ( shiftwidth() * (num_unmatched_right - ignore) )
endif
endif
@@ -339,12 +339,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 - shiftwidth()
" 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 - shiftwidth()
" echom 'curr - end - indent ' . ind
elseif line =~? '^\s*when\>'
let ind = s:GetStmtStarterIndent('when', v:lnum)
@@ -352,7 +352,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 - shiftwidth()
" endif
" elseif line =~ '^\s*)\s*;\?\s*$'
" elseif line =~ '^\s*)'
@@ -371,14 +371,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 - shiftwidth()
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 - ( shiftwidth() * (num_unmatched_right - ignore) )
endif
" endif
endif
diff -r 3bd553b9e4bf runtime/indent/systemverilog.vim
--- a/runtime/indent/systemverilog.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/systemverilog.vim Tue Mar 17 21:55:49 2015 +0800
@@ -1,7 +1,7 @@
" Vim indent file
" Language: SystemVerilog
" Maintainer: kocha <kocha.lsifrontend@gmail.com>
-" Last Change: 12-Aug-2013.
+" Last Change: 17-Mar-2015.
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -29,7 +29,7 @@
if exists('b:systemverilog_indent_width')
let offset = b:systemverilog_indent_width
else
- let offset = &sw
+ let offset = shiftwidth()
endif
if exists('b:systemverilog_indent_modules')
let indent_modules = offset
diff -r 3bd553b9e4bf runtime/indent/tcl.vim
--- a/runtime/indent/tcl.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/tcl.vim Tue Mar 17 21:55:49 2015 +0800
@@ -56,7 +56,7 @@
if line =~ '^\s*\*'
return cindent(v:lnum)
elseif line =~ '^\s*}'
- return indent(v:lnum) - &sw
+ return indent(v:lnum) - shiftwidth()
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) * shiftwidth()
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)) * shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/tcsh.vim
--- a/runtime/indent/tcsh.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/tcsh.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
endif
if line =~ '\v^\s*breaksw>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
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 - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/tex.vim
--- a/runtime/indent/tex.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/tex.vim Tue Mar 17 21:55:49 2015 +0800
@@ -215,12 +215,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 + shiftwidth()
if g:tex_indent_items
" Add another sw for item-environments
if line =~ g:tex_itemize_env
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
endif
@@ -231,11 +231,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 - shiftwidth()
endif
endif
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
if g:tex_indent_brace
@@ -263,7 +263,7 @@
endif
endfor
- let ind += (sum1 - sum2) * &sw
+ let ind += (sum1 - sum2) * shiftwidth()
endif
if g:tex_indent_paretheses
@@ -276,12 +276,12 @@
" '\item' or '\bibitem' itself:
if cline =~ g:tex_items
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" lines following to '\item' are intented once again:
if line =~ g:tex_items
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
diff -r 3bd553b9e4bf runtime/indent/tf.vim
--- a/runtime/indent/tf.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/tf.vim Tue Mar 17 21:55:49 2015 +0800
@@ -38,14 +38,14 @@
endif
if line =~ '\(/def.*\\\|/for.*\(%;\s*\)\@\<!\\\)$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
elseif line =~ '\(/if\|/else\|/then\)'
if line !~ '/endif'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
elseif line =~ '/while'
if line !~ '/done'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
@@ -53,11 +53,11 @@
if line =~ '\(/else\|/endif\|/then\)'
if line !~ '/if'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
elseif line =~ '/done'
if line !~ '/while'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
diff -r 3bd553b9e4bf runtime/indent/tilde.vim
--- a/runtime/indent/tilde.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/tilde.vim Tue Mar 17 21:55:49 2015 +0800
@@ -25,11 +25,11 @@
endif
if getline(v:lnum) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>'
- return indent(v:lnum) - &sw
+ return indent(v:lnum) - shiftwidth()
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) + shiftwidth()
else
return -1
endif
diff -r 3bd553b9e4bf runtime/indent/treetop.vim
--- a/runtime/indent/treetop.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/treetop.vim Tue Mar 17 21:55:49 2015 +0800
@@ -26,12 +26,12 @@
let line = getline(pnum)
if line =~ '^\s*\%(grammar\|module\|rule\)\>'
- let ind += &sw
+ let ind += shiftwidth()
endif
let line = getline(v:lnum)
if line =~ '^\s*end\>'
- let ind -= &sw
+ let ind -= shiftwidth()
end
retur ind
diff -r 3bd553b9e4bf runtime/indent/vb.vim
--- a/runtime/indent/vb.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/vb.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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 + shiftwidth()
endif
" Subtract
if this_line =~? '^\s*\<end\>\s\+\<select\>'
if previous_line !~? '^\s*\<select\>'
- let ind = ind - 2 * &sw
+ let ind = ind - 2 * shiftwidth()
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 - shiftwidth()
endif
elseif this_line =~? '^\s*\<\(end\|else\|elseif\|until\|loop\|next\|wend\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
elseif this_line =~? '^\s*\<\(case\|default\)\>'
if previous_line !~? '^\s*\<select\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
diff -r 3bd553b9e4bf runtime/indent/verilog.vim
--- a/runtime/indent/verilog.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/verilog.vim Tue Mar 17 21:55:49 2015 +0800
@@ -38,7 +38,7 @@
if exists('b:verilog_indent_width')
let offset = b:verilog_indent_width
else
- let offset = &sw
+ let offset = shiftwidth()
endif
if exists('b:verilog_indent_modules')
let indent_modules = offset
diff -r 3bd553b9e4bf runtime/indent/vhdl.vim
--- a/runtime/indent/vhdl.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/vhdl.vim Tue Mar 17 21:55:49 2015 +0800
@@ -114,9 +114,9 @@
return ind2 + m
else
if g:vhdl_indent_genportmap
- return ind2 + stridx(prevs_noi, '(') + &sw
+ return ind2 + stridx(prevs_noi, '(') + shiftwidth()
else
- return ind2 + &sw
+ return ind2 + shiftwidth()
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 + shiftwidth()
endif
endif
@@ -218,12 +218,12 @@
let ps = getline(pn)
if (ps =~? s:NC.'\<begin\>')
- return indent(pn) - &sw
+ return indent(pn) - shiftwidth()
endif
endwhile
if (pn == 0)
- return ind - &sw
+ return ind - shiftwidth()
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 + shiftwidth()
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 + shiftwidth()
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 + shiftwidth()
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 + shiftwidth()
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 + shiftwidth()
endif
" ****************************************************************************************
@@ -322,7 +322,7 @@
if prevs =~? s:NC.'\<is'.s:ES
return ind
elseif prevs !~? s4
- return ind - &sw
+ return ind - shiftwidth()
else
return ind2
endif
@@ -336,7 +336,7 @@
if prevs =~? '^\s*\%(elsif\|'.s5.'\)'
return ind
else
- return ind - &sw
+ return ind - shiftwidth()
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 * shiftwidth()
elseif ps =~? '^\s*when\>'
- return indent(pn) - &sw
+ return indent(pn) - shiftwidth()
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 - shiftwidth()
endif
" indent: -sw
" keyword: ")"
" where: start of current line
if curs =~ '^\s*)'
- return ind - &sw
+ return ind - shiftwidth()
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 - shiftwidth()
endif
" ****************************************************************************************
diff -r 3bd553b9e4bf runtime/indent/vim.vim
--- a/runtime/indent/vim.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/vim.vim Tue Mar 17 21:55:49 2015 +0800
@@ -58,19 +58,19 @@
if exists("g:vim_indent_cont")
let ind = ind + g:vim_indent_cont
else
- let ind = ind + &sw * 3
+ let ind = ind + s:sw() * 3
endif
elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END'
- let ind = ind + &sw
+ let ind = ind + s:sw()
else
" A line starting with :au does not increment/decrement indent.
if prev_text !~ '^\s*au\%[tocmd]'
let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
if i >= 0
- let ind += &sw
+ let ind += s:sw()
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
\ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$'
- let ind -= &sw
+ let ind -= s:sw()
endif
endif
endif
@@ -82,7 +82,7 @@
let i = match(prev_text, '[^\\]|\s*\(ene\@!\)')
if i > 0 && prev_text !~ '^\s*au\%[tocmd]'
if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$'
- let ind = ind - &sw
+ let ind = ind - s:sw()
endif
endif
@@ -90,12 +90,22 @@
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
" :endfun, :else and :augroup END.
if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)'
- let ind = ind - &sw
+ let ind = ind - s:sw()
endif
return ind
endfunction
+if exists('*shiftwidth')
+ func s:sw()
+ return shiftwidth()
+ endfunc
+else
+ func s:sw()
+ return shiftwidth()
+ endfunc
+endif
+
let &cpo = s:keepcpo
unlet s:keepcpo
diff -r 3bd553b9e4bf runtime/indent/xf86conf.vim
--- a/runtime/indent/xf86conf.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/xf86conf.vim Tue Mar 17 21:55:49 2015 +0800
@@ -26,11 +26,11 @@
let ind = indent(lnum)
if getline(lnum) =~? '^\s*\(Sub\)\=Section\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff -r 3bd553b9e4bf runtime/indent/xinetd.vim
--- a/runtime/indent/xinetd.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/xinetd.vim Tue Mar 17 21:55:49 2015 +0800
@@ -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) * shiftwidth()
+ \ - s:count_braces(v:lnum, 0) * shiftwidth()
endfunction
let &cpo = s:keepcpo
diff -r 3bd553b9e4bf runtime/indent/xml.vim
--- a/runtime/indent/xml.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/xml.vim Tue Mar 17 21:55:49 2015 +0800
@@ -67,7 +67,7 @@
fun! <SID>XmlIndentSum(lnum, style, add)
let line = getline(a:lnum)
if a:style == match(line, '^\s*</')
- return (&sw *
+ return (shiftwidth() *
\ (<SID>XmlIndentWithPattern(line, b:xml_indent_open)
\ - <SID>XmlIndentWithPattern(line, b:xml_indent_close)
\ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add
diff -r 3bd553b9e4bf runtime/indent/zimbu.vim
--- a/runtime/indent/zimbu.vim Sat Mar 14 15:35:52 2015 +0100
+++ b/runtime/indent/zimbu.vim Tue Mar 17 21:55:49 2015 +0800
@@ -74,9 +74,9 @@
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|String\\|Char\\)$'")
if pp > 0
- return indent(prevLnum) + &sw
+ return indent(prevLnum) + shiftwidth()
endif
- return indent(prevLnum) + &sw * 2
+ return indent(prevLnum) + shiftwidth() * 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 += shiftwidth()
endif
if thisline =~ '^\s*\(}\|ELSEIF\>\|ELSE\>\|CATCH\|FINALLY\|GENERATE_ELSEIF\>\|GENERATE_ELSE\>\|UNTIL\>\)'
- let plindent -= &sw
+ let plindent -= shiftwidth()
endif
if thisline =~ '^\s*\(CASE\>\|DEFAULT\>\)' && prevline !~ '^\s*SWITCH\>'
- let plindent -= &sw
+ let plindent -= shiftwidth()
endif
" line up continued comment that started after some code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment