Right now I’m just getting started with Swift, so I’m practicing with simple programs and using the command line with vim. This is fine so far - I can create a project by running swift package generate-xcodeproj
and run an XCTest suite with swift test.
A good vim plugin for swift is swift.vim.
Eventually I imagine I’ll need to migrate to a proper IDE. AppCode by JetBrains seems promising, because I like IntelliJ (which I use for Java and Scala; the vim emulation is pretty good). Unfortunately, unlike IntelliJ, AppCode is not free. Xcode has no vim emulation as far as I can tell, so it’s not an option.
I haven’t had the best luck with autocomplete in vim. YouCompleteMe was the best thing I could find. The issue I had was when dealing with large C namespaces–it got super clunky (compared to Xcode/VS). This was on a Vulkan project which is just one huge c header file with a million things in it so take it with a grain of salt. I’m still somewhat convinced I could get it working better and that I did something wrong when setting it up. I spent an entire day trying to get things to a point where I could just move to vim and tmux but I guess I’m too precious about auto-complete and syntax highlighting.
VSCode has a vim extension, though last I checked code folding didn’t work which was a deal breaker. A devops buddy of mine uses the Xcode plugin Jeremy mentioned and says it made Xcode usable for him
If anyone gets (or already has) a vim setup that has decent syntax highlighting and responsive auto-complete for Swift, please share your dot files as I’d very much love to make the move. Right now I’m using Xcode for writing and light debugging and then compiling and running on Ubuntu when it comes to any significant training/testing. The ideal scenario would be to be able to remote debug on Ubuntu from Xcode, breakpoints and all. I tried for a bit but couldn’t get lldb-server to work for me It’s not critical enough to fuss or waste anyone’s time over at this point, however.