diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2018-10-08 19:00:59 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2018-10-08 19:00:59 +0200 |
commit | fd74d8b2b170b540680a9bbf6c64990f8ebafd08 (patch) | |
tree | b1fdef6203a78a21053d1b8e0666ab7a38c36df2 /indent/go.vim | |
parent | 055f7710b65dfa2df52fc0b5be2486ae36ac5751 (diff) | |
download | vim-polyglot-3.3.3.tar.gz vim-polyglot-3.3.3.zip |
Updatev3.3.3
Diffstat (limited to 'indent/go.vim')
-rw-r--r-- | indent/go.vim | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/indent/go.vim b/indent/go.vim index fd973e45..887fb587 100644 --- a/indent/go.vim +++ b/indent/go.vim @@ -26,17 +26,6 @@ if exists("*GoIndent") finish endif -" use shiftwidth function only if it's available -if exists('*shiftwidth') - func s:sw() - return shiftwidth() - endfunc -else - func s:sw() - return &sw - endfunc -endif - function! GoIndent(lnum) let prevlnum = prevnonblank(a:lnum-1) if prevlnum == 0 @@ -51,19 +40,23 @@ function! GoIndent(lnum) let ind = previ + if prevl =~ ' = `[^`]*$' + " previous line started a multi-line raw string + return 0 + endif if prevl =~ '[({]\s*$' " previous line opened a block - let ind += s:sw() + let ind += shiftwidth() endif if prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let ind += s:sw() + let ind += shiftwidth() endif " TODO: handle if the previous line is a label. if thisl =~ '^\s*[)}]' " this line closed a block - let ind -= s:sw() + let ind -= shiftwidth() endif " Colons are tricky. @@ -71,7 +64,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 -= s:sw() + let ind -= shiftwidth() endif return ind |