Skip to content

Commit c4a1fa4

Browse files
tyruches
authored andcommitted
Use shiftwidth() instead of &shiftwidth
1 parent 45003b4 commit c4a1fa4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

indent/scala.vim

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -412,19 +412,19 @@ function! GetScalaIndent()
412412
if prevline =~ '^\s*\.'
413413
return ind
414414
else
415-
return ind + &shiftwidth
415+
return ind + shiftwidth()
416416
endif
417417
endif
418418

419419
" Indent html literals
420420
if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$'
421421
call scala#ConditionalConfirm("3")
422-
return ind + &shiftwidth
422+
return ind + shiftwidth()
423423
endif
424424

425425
" assumes curly braces around try-block
426426
if curline =~ '^\s*}\s*\<catch\>'
427-
return ind - &shiftwidth
427+
return ind - shiftwidth()
428428
elseif curline =~ '^\s*\<catch\>'
429429
return ind
430430
endif
@@ -438,7 +438,7 @@ function! GetScalaIndent()
438438
\ || prevline =~ '^\s*\%(}\s*\)\?\<else\>\s*$'
439439
\ || prevline =~ '=\s*$'
440440
call scala#ConditionalConfirm("4")
441-
let ind = ind + &shiftwidth
441+
let ind = ind + shiftwidth()
442442
elseif prevline =~ '^\s*\<\%(}\?\s*else\s\+\)\?if\>' && curline =~ '^\s*}\?\s*\<else\>'
443443
return ind
444444
endif
@@ -447,7 +447,7 @@ function! GetScalaIndent()
447447
let bracketCount = scala#CountBrackets(prevline, '{', '}')
448448
if bracketCount > 0 || prevline =~ '.*{\s*$'
449449
call scala#ConditionalConfirm("5b")
450-
let ind = ind + &shiftwidth
450+
let ind = ind + shiftwidth()
451451
elseif bracketCount < 0
452452
call scala#ConditionalConfirm("6b")
453453
" if the closing brace actually completes the braces entirely, then we
@@ -475,7 +475,7 @@ function! GetScalaIndent()
475475
let bracketCount = scala#CountBrackets(prevline, '(', ')')
476476
if bracketCount > 0 || prevline =~ '.*(\s*$'
477477
call scala#ConditionalConfirm("5a")
478-
let ind = ind + &shiftwidth
478+
let ind = ind + shiftwidth()
479479
elseif bracketCount < 0
480480
call scala#ConditionalConfirm("6a")
481481
" if the closing brace actually completes the braces entirely, then we
@@ -497,7 +497,7 @@ function! GetScalaIndent()
497497
else
498498
" This is the only part that's different from from the '{', '}' one below
499499
" Yup... some refactoring is necessary at some point.
500-
let ind = ind + (bracketCount * &shiftwidth)
500+
let ind = ind + (bracketCount * shiftwidth())
501501
let lineCompletedBrackets = 1
502502
endif
503503
endif
@@ -506,7 +506,7 @@ function! GetScalaIndent()
506506
if curline =~ '^\s*}\?\s*\<else\>\%(\s\+\<if\>\s*(.*)\)\?\s*{\?\s*$' &&
507507
\ ! scala#LineIsCompleteIf(prevline) &&
508508
\ prevline !~ '^.*}\s*$'
509-
let ind = ind - &shiftwidth
509+
let ind = ind - shiftwidth()
510510
endif
511511

512512
" Subtract a 'shiftwidth' on '}' or html
@@ -517,7 +517,7 @@ function! GetScalaIndent()
517517
return indent(matchline)
518518
elseif curline =~ '^\s*</[a-zA-Z][^>]*>'
519519
call scala#ConditionalConfirm("14c")
520-
return ind - &shiftwidth
520+
return ind - shiftwidth()
521521
endif
522522

523523
let prevParenCount = scala#CountParens(prevline)
@@ -529,7 +529,7 @@ function! GetScalaIndent()
529529
let prevCurlyCount = scala#CountCurlies(prevline)
530530
if prevCurlyCount == 0 && prevline =~ '^.*\%(=>\|⇒\)\s*$' && prevline !~ '^\s*this\s*:.*\%(=>\|⇒\)\s*$' && curline !~ '^\s*\<case\>'
531531
call scala#ConditionalConfirm("16")
532-
let ind = ind + &shiftwidth
532+
let ind = ind + shiftwidth()
533533
endif
534534

535535
if ind == originalIndentValue && curline =~ '^\s*\<case\>'
@@ -555,7 +555,7 @@ function! GetScalaIndent()
555555
if scala#LineIsAClosingXML(prevline)
556556
if scala#LineCompletesXML(prevlnum, prevline)
557557
call scala#ConditionalConfirm("20a")
558-
return ind - &shiftwidth
558+
return ind - shiftwidth()
559559
else
560560
call scala#ConditionalConfirm("20b")
561561
return ind
@@ -566,7 +566,7 @@ function! GetScalaIndent()
566566
"let indentMultiplier = scala#LineCompletesDefValr(prevlnum, prevline)
567567
"if indentMultiplier != 0
568568
" call scala#ConditionalConfirm("19a")
569-
" let ind = ind - (indentMultiplier * &shiftwidth)
569+
" let ind = ind - (indentMultiplier * shiftwidth())
570570
let defValrLine = scala#Test(prevlnum, prevline, '{', '}')
571571
if defValrLine != -1
572572
call scala#ConditionalConfirm("21a")
@@ -575,10 +575,10 @@ function! GetScalaIndent()
575575
call scala#ConditionalConfirm("21b")
576576
if scala#GetLine(prevnonblank(prevlnum - 1)) =~ '^.*\<else\>\s*\%(//.*\)\?$'
577577
call scala#ConditionalConfirm("21c")
578-
let ind = ind - &shiftwidth
578+
let ind = ind - shiftwidth()
579579
elseif scala#LineCompletesIfElse(prevlnum, prevline)
580580
call scala#ConditionalConfirm("21d")
581-
let ind = ind - &shiftwidth
581+
let ind = ind - shiftwidth()
582582
elseif scala#CountParens(curline) < 0 && curline =~ '^\s*)' && scala#GetLine(scala#GetLineThatMatchesBracket('(', ')')) =~ '.*(\s*$'
583583
" Handles situations that look like this:
584584
"
@@ -592,7 +592,7 @@ function! GetScalaIndent()
592592
" 10
593593
" ).somethingHere()
594594
call scala#ConditionalConfirm("21e")
595-
let ind = ind - &shiftwidth
595+
let ind = ind - shiftwidth()
596596
endif
597597
endif
598598
endif

0 commit comments

Comments
 (0)