Commit Graph

36 Commits

Author SHA1 Message Date
Keith Smiley
f2ce1a39a9 Handle multiple closure indents 2016-01-08 16:35:23 -08:00
Keith Smiley
624e1a4778 Remove comment special casing
I don't know what I was thinking with this. Previously all comment lines
would indent as the line above them. This doesn't work because of many
cases such as:

```swift
if foo {
  // something
}
```

Previously this comment would be forced on to column 0. Now comments are
indented as everything else.
2016-01-08 16:26:46 -08:00
Keith Smiley
8d5578d417 Fix multiline paren indenting
This fixes the python-style indenting that was previously done. If you
had a codeblock like this:

```swift
let foo = Thing(arg: arg,
                arg2: arg2)
```

The indent of the second line would be the opening paren +1. This has
changed to:

```swift
let foo = Thing(arg: arg,
    arg2: arg2)
```

Which is the indent of the opening paren line +1 'shiftwidth'
2016-01-08 16:21:37 -08:00
Keith Smiley
7db0cb4226 Fix closing square bracket indent
This fixes the case where the closing square bracket of something (like
an array) is on the same line as an entry, so it should be indented one
level above the opening square bracket
2016-01-08 15:46:54 -08:00
Keith Smiley
72ec3f8df3 Reindent switch statement cases with : 2016-01-08 13:04:00 -08:00
Keith Smiley
091fbad512 Fix indent picking wrong brackets 2015-10-18 18:00:17 -07:00
Keith Smiley
39a5abebed Handle more indention cases, now without smartindent
Closes #66
2015-10-18 16:49:15 -07:00
Keith Smiley
c22863f258 Enforce smartindent
This is currently needed for indention while typing to work correctly.

See #66
2015-10-18 15:55:54 -07:00
Keith Smiley
f6279335a4 Fix broken syntax checking
I updated this function without getting the actual line and column
numbers, just passing .
2015-10-18 15:54:43 -07:00
Keith Smiley
51777f39d5 Fix ] indent issue
Previously when you typed, or tried to reindent a ] character, it didn't
work. This was because the brackets weren't escaped in search pair. This
also fixes auto indenting when typing the close square bracket. This is
now special cased because search pair returns no matches right after
typing the bracket.
2015-10-18 14:39:53 -07:00
Keith Smiley
375b1dd573 Handle if statement indention with empty bodies
This case:

```swift
if(true){
}else{
}
```

Previously the else line, and closing bracket would be indented too many
steps.

Closes #40
2015-10-18 12:46:59 -07:00
Keith Smiley
6a20018b90 Fix comment and string indentation issue
This updates the previously dumb NumberOfMatches function to take the
index of the line, and make sure the match at that line shouldn't be
ignored. It should be ignored if the character is part of a string or a
comment. Without this change those characters could be taken into
account when indenting subsequent lines.

Closes #65
2015-10-18 12:33:32 -07:00
Keith Smiley
768ce0289e Improve indent near comments
This fixes a issue where indentation would take characters that were in
comments into account. Meaning that if you had something like this:

```swift
// if something {
let foo = 1
```

The second line would be indented.

This also updates the indent file to no longer use normal mode commands
and instead call cursor() which I apparently didn't know about at the
time of writing this originally.

Closes: https://github.com/keith/swift.vim/pull/58
2015-10-17 17:09:52 -07:00
Keith Smiley
a04e06aedc Small cleanup 2014-12-13 11:58:31 -08:00
Keith Smiley
86ec27baed Fix multi-line function declaration 2014-12-13 11:58:31 -08:00
Keith Smiley
b3a239bd87 Attempt indentkeys removal 2014-12-13 11:58:31 -08:00
Keith Smiley
f5ace28838 Remove brackets from indentkeys
This are handled already, this just moved them to the left a second time
when brackets were not auto inserted
2014-12-13 11:58:31 -08:00
Keith Smiley
a64f298efb Remove logging 2014-12-13 11:58:31 -08:00
Keith Smiley
40746f1104 Cleanup a bit 2014-12-13 11:58:31 -08:00
Keith Smiley
f20ecf18ca Case statements 2014-12-13 11:58:31 -08:00
Keith Smiley
2454d0d6a7 Handle square brackets 2014-12-13 11:58:30 -08:00
Keith Smiley
3ab34b1435 Moving away from cindent 2014-12-13 11:58:30 -08:00
Keith Smiley
f9a14e4e15 Working on indentation 2014-12-13 11:58:30 -08:00
Keith Smiley
cfa66353b1 Fixes curly braces in strings affecting indentation
Closes #25
2014-11-22 18:57:30 -08:00
Keith Smiley
17d3475f58 Fix unrelated function issue 2014-10-22 13:54:31 -07:00
Keith Smiley
73283a19b0 Fix some indentation issues 2014-10-22 13:48:09 -07:00
Keith Smiley
1acdb2f128 Fix square bracket indents 2014-08-24 18:35:48 -07:00
Keith Smiley
d7fd8e73d0 Give up aligning by colons
Instead align to the opening paren
2014-08-16 15:21:58 -07:00
Keith Smiley
7e0eb6d668 Fix nested parens in multiline declarations
Fixes #19 I hope
2014-08-16 14:39:43 -07:00
Keith Smiley
a640cfdd1a Fix previousNum comparison that was commented out 2014-08-16 14:21:32 -07:00
Keith Smiley
1ffd1454a4 Indent multi line paren stuff
Fixes #19
2014-08-16 14:18:23 -07:00
Keith Smiley
fdb1ac8e71 Fix indenting with ==
Closes #16
2014-08-16 13:52:10 -07:00
Keith Smiley
8a44691576 Fix indent issue
When the previous line had {} it would still indent the next line as if
you where inside of the block. Same with []
2014-06-15 20:26:51 -07:00
Keith Smiley
cd505ea162 Align colons of arguments 2014-06-15 12:23:14 -07:00
Keith Smiley
fe983fa7e1 Indentation for after [ 2014-06-15 11:40:30 -07:00
Keith Smiley
43845fa442 Add indention 2014-06-13 16:30:59 -07:00