My Byte of Code Blog. Tips and observations on creating software with Objective-C, C/C++, Python, Cocoa and Boost on Mac.

Sunday, January 02, 2011

Build Xcode project from within Vim

To be able to compile Xcode project from Vim with :mak I set makeprg option to use xcodebuild instead of Makefile.

I set makeprg for objective-c files in local ftplugin for objective-c ~/.vim/ftplugin/objc.vim:

set makeprg=xcodebuild\ -activetarget\ -activeconfiguration

Now when I compile from Vim with :mak, the current active build and configuration gets compiled and you can iterate in Vim over any errors or warnings the way you would using Makefile:

:cope - Open a window to show the current list of errors
:cn   - Skip to next error in the list
:cp   - Skip to previous error in the list
:clo  - Close current window