summaryrefslogtreecommitdiffstats
path: root/indent/go.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-02-11 11:27:11 -0800
committerAdam Stankiewicz <sheerun@sher.pl>2015-02-11 11:27:11 -0800
commit6cd2d5417d728ea96c5c52b34629c944a89eec60 (patch)
treef6d49573e7a22b1ede56055d3952707eab085c18 /indent/go.vim
parentb7a30b1f1a963902d9743ae229a1f9d18b887e17 (diff)
downloadvim-polyglot-1.11.4.tar.gz
vim-polyglot-1.11.4.zip
Updatev1.11.4
Diffstat (limited to '')
-rw-r--r--indent/go.vim9
1 files changed, 5 insertions, 4 deletions
diff --git a/indent/go.vim b/indent/go.vim
index faf4d79e..660aa506 100644
--- a/indent/go.vim
+++ b/indent/go.vim
@@ -37,20 +37,21 @@ function! GoIndent(lnum)
let previ = indent(prevlnum)
let ind = previ
+ let s:shiftwidth = shiftwidth()
if prevl =~ '[({]\s*$'
" previous line opened a block
- let ind += &sw
+ let ind += s:shiftwidth
endif
if prevl =~# '^\s*\(case .*\|default\):$'
" previous line is part of a switch statement
- let ind += &sw
+ let ind += s:shiftwidth
endif
" TODO: handle if the previous line is a label.
if thisl =~ '^\s*[)}]'
" this line closed a block
- let ind -= &sw
+ let ind -= s:shiftwidth
endif
" Colons are tricky.
@@ -58,7 +59,7 @@ function! GoIndent(lnum)
" We ignore trying to deal with jump labels because (a) they're rare, and
" (b) they're hard to disambiguate from a composite literal key.
if thisl =~# '^\s*\(case .*\|default\):$'
- let ind -= &sw
+ let ind -= s:shiftwidth
endif
return ind