File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -37,28 +37,29 @@ function! GoIndent(lnum)
37
37
let previ = indent (prevlnum)
38
38
39
39
let ind = previ
40
+ let s: shiftwidth = shiftwidth ()
40
41
41
42
if prevl = ~ ' [({]\s*$'
42
43
" previous line opened a block
43
- let ind += & sw
44
+ let ind += s: shiftwidth
44
45
endif
45
46
if prevl = ~# ' ^\s*\(case .*\|default\):$'
46
47
" previous line is part of a switch statement
47
- let ind += & sw
48
+ let ind += s: shiftwidth
48
49
endif
49
50
" TODO: handle if the previous line is a label.
50
51
51
52
if thisl = ~ ' ^\s*[)}]'
52
53
" this line closed a block
53
- let ind -= & sw
54
+ let ind -= s: shiftwidth
54
55
endif
55
56
56
57
" Colons are tricky.
57
58
" We want to outdent if it's part of a switch ("case foo:" or "default:").
58
59
" We ignore trying to deal with jump labels because (a) they're rare, and
59
60
" (b) they're hard to disambiguate from a composite literal key.
60
61
if thisl = ~# ' ^\s*\(case .*\|default\):$'
61
- let ind -= & sw
62
+ let ind -= s: shiftwidth
62
63
endif
63
64
64
65
return ind
You can’t perform that action at this time.
0 commit comments