Fix indenting with ==

Closes #16
This commit is contained in:
Keith Smiley
2014-08-16 13:52:10 -07:00
parent 9a31e2fbfc
commit fdb1ac8e71
3 changed files with 24 additions and 5 deletions

View File

@@ -197,7 +197,7 @@ func foo<T: Sequence>() {
init(argv: UnsafePointer<CString>, count: CInt) {
for i in 1..count {
let index = Int(i);
let index = Int(i)
let arg = String.fromCString(argv[index])
arguments.append(arg)
}
@@ -237,3 +237,12 @@ override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {}
client.host = "example.com"
client.pathPrefix = "/foo/"
func foo () {
override func loadView() {
super.loadView()
if foo {
foobar
}
}
}

View File

@@ -1,7 +1,7 @@
setlocal commentstring=//\ %s
" @-@ adds the literal @ to iskeyword for @IBAction and similar
setlocal iskeyword+=?,!,@-@,#
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal completefunc=syntaxcomplete#Complete

View File

@@ -34,8 +34,9 @@ function! SwiftIndent()
return indent(v:lnum) - &tabstop
endif
" Make sure the line has a colon and that the line above isn't blank
let thisColon = match(line, ":")
if thisColon > 0
if thisColon > 0 && previousNum == v:lnum - 1
let prevColon = match(previous, ":")
if prevColon > 0
let minInd = &tabstop + indent(v:lnum)
@@ -48,6 +49,15 @@ function! SwiftIndent()
endif
endif
" Correctly indent bracketed things when using =
if line =~ "}"
let newIndent = &tabstop
if previous =~ "{"
let newIndent = 0
endif
return indent(previousNum) - newIndent
endif
return indent(previousNum)
endfunction