Swift indentation for vim


(Aaron Bohannon) #1

You have probably noticed that the available vim plugins do not provide
robust support for automatic indentation of Swift code. The most complete
vim plugin appears to be the one here:

https://github.com/keith/swift.vim

I found that its indentation script would frequently get confused, though.
Therefore, it seemed necessary for me to create a new indentation script.
Mine is configurable and (appears to be) extremely robust. My script is
available here:

https://gist.github.com/morefun2compute/bdc6ee6d8b9add60a03b318bd91ba570

Unfortunately, I cannot distribute my script as a standalone plugin because
it depends upon syntax highlighting support, which I have not
re-implemented (nor do I plan to re-implement it at this point in time).
If any of you have advice on how to distribute my script so that it can be
easily installed, please let me know. For now, you will have to copy my
file into the location `.../indent/swift.vim` within the plugin I mentioned
above. (I suspect it will also work with the vim plugin supplied in the
Swift source tree, although you will have to add the `indent` directory
manually.)

- Aaron


(Keith Smiley) #2

If you're interested in contributing that script to my repo I'm
definitely open to it!

There are a ton of issues, as you saw with the current script that I
just haven't spent the time to try and fix lately, so it would be great
to start from a new robust base.

ยทยทยท

--
Keith Smiley

On 01/27, Aaron Bohannon via swift-users wrote:

You have probably noticed that the available vim plugins do not provide
robust support for automatic indentation of Swift code. The most complete
vim plugin appears to be the one here:

https://github.com/keith/swift.vim

I found that its indentation script would frequently get confused, though.
Therefore, it seemed necessary for me to create a new indentation script.
Mine is configurable and (appears to be) extremely robust. My script is
available here:

https://gist.github.com/morefun2compute/bdc6ee6d8b9add60a03b318bd91ba570

Unfortunately, I cannot distribute my script as a standalone plugin because
it depends upon syntax highlighting support, which I have not
re-implemented (nor do I plan to re-implement it at this point in time).
If any of you have advice on how to distribute my script so that it can be
easily installed, please let me know. For now, you will have to copy my
file into the location `.../indent/swift.vim` within the plugin I mentioned
above. (I suspect it will also work with the vim plugin supplied in the
Swift source tree, although you will have to add the `indent` directory
manually.)

- Aaron

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users