Commit 816f4bb1 authored by David Symonds's avatar David Symonds

misc/vim: drop indent support for jump labels.

It interferes with keys in composite literals,
which are much more common.

R=dchest, jnwhiteh, rlight2
CC=golang-dev
https://golang.org/cl/4521065
parent b2400c28
......@@ -54,18 +54,12 @@ function! GoIndent(lnum)
endif
" Colons are tricky.
" We want to outdent if it's part of a switch ("case foo:" or "default:"),
" We want to outdent if it's part of a switch ("case foo:" or "default:").
" 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
endif
" ... and put jump labels in the first column (ignore "default:").
if thisl =~ '^\s*\S\+:\s*$'
" ignore "default:" and if there's a string on the line;
" the latter will more likely be something like "blah: %v".
if thisl !~# '^\s*default:\s*$' && thisl !~# '".*:'
return 0
endif
endif
return ind
endfunction
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment