Swift development environment for vim users

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.

What are others using?

I found the vim plugin from Apple a little better, so I packaged it here:


I guess I try visualcode: https://nshipster.com/vscode/

and just seeing this thread here: Swift dev env for VSCode users

1 Like

This is great! I can stick to vim using a plugin such as vim-lsp.

Perhaps I won’t need any advanced IDE features after all, because I won’t be developing for iOS or macOS.

I’m a vim user but knows nothing about swift (on my to-learn list:).
Have you tried vim-ale plugin?

1 Like

I haven’t tried it yet. I’ll definitely check it out - thanks for the suggestion!

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 :slight_smile:

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 :frowning: It’s not critical enough to fuss or waste anyone’s time over at this point, however.

1 Like