# Using Vim for Swift Development with Syntastic and swift.vim

DevFeed: [Using Vim for Swift Development with Syntastic and swift.vim](<https://devfeed.tech/articles/vim-and-swift-development-in-a-post-apocalyptic-world-22311.md>)

Original publisher: [Read original article](<https://www.thecodedself.com/Vim-Swift/>)

Author: Keegan Rush

Published: 2017-06-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [The Coded Self](<https://devfeed.tech/sources/the-coded-self.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Vim](<https://devfeed.tech/topics/vim.md>), [Syntax Highlighting](<https://devfeed.tech/topics/syntax-highlighting.md>), [Xcode](<https://devfeed.tech/topics/xcode.md>)

Tags: [plugin](<https://devfeed.tech/tags/plugin.md>), [swift](<https://devfeed.tech/tags/swift.md>), [syntax-highlighting](<https://devfeed.tech/tags/syntax-highlighting.md>), [vim](<https://devfeed.tech/tags/vim.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

## AI overview

A tutorial for configuring Vim to work on Swift projects when Xcode is unavailable or malfunctioning. It uses the Syntastic and swift.vim plugins to compile SwiftPM packages on save, show errors and warnings in Vim, and enable SwiftLint checking.

## Source excerpt

Disclaimer: I don't advocate using Vim seriously as your primary development environment. As powerful as it is, Vim remains a text editor, not an IDE. I ran into some Xcode problems the other day where I lost syntax highlighting and code completion in Swift files. What should we do when Xcode just doesn't work? I joked that at this point, it might be easier to just use Vim for my Swift development. Well... It's not hard to use an arbitrary text editor to write some code and then run it through a compiler. For this setup, we want something a little bit more pleasant to use. The passionate programmers that we are, we want to be able to work on non-trivial Swift projects, with or without Xcode, from the comfort of our own home or in a post-apocalyptic nuclear bunker (hey, let's not rule anything out). We want: Those sweet Vim keybindings An easy way to compile and run code Resilience against Xcode temper tantrums Syntax highlighting that works. All. The. Time. We'll be using some Vim plugins. You'll need some means of plugin management. I'll be using Pathogen. Syntastic Syntastic provides syntax highlighting in Vim for many languages. It does this by associating checkers with a particular language. When you save the file you're working on, it runs the appropriate checkers. A checker is essentially an adapter between the world of Vim with Syntastic and your language with its compiler or linter. What we want to accomplish through Syntastic is to easily compile a project when the current file is saved and surface any errors or warnings inside Vim. Using Pathogen, install Syntastic. cd ~/.vim/bundle && \ git clone --depth=1 https://github.com/vim-syntastic/syntastic.git swift.vim swift.vim has a SwiftPM checker that will compile a project and a SwiftLint checker to remind us that we occasionally have no idea what we're doing. Install swift.vim: cd ~/.vim/bundle && \ git clone --depth=1 https://github.com/keith/swift.vim SwiftPM Go to a Swift project containing a Package.swif