sponsor Vim development Vim logo Vim Book Ad

cocoa.vim : Plugin for Cocoa/Objective-C development

 script karma  Rating 318/130, Downloaded by 7338    Comments, bugs, improvements  Vim wiki

created by
Michael Sanders
 
script type
utility
 
description
Cocoa.vim is a collection of scripts designed to make it easier to develop Cocoa/Objective-C applications. It includes enhanced syntax highlighting, code completion, documentation lookup, as well as a number of other features that can be used to integrate Vim with Xcode, allowing you to essentially replace Xcode's editor with Vim.

This plugin includes the following features:
1. Enhanced syntax highlighting Vim's syntax highlighting for Objective-C seemed incomplete to me, so I have added a few niceties, such as highlighting Cocoa keywords and differentiating the method name and passed objects in method calls and definitions. You can see a before & after screenshot here: http://imgur.com/AGpoL.png
2. Xcode-like mappings (where convenient) mappings such as ⌘R to build & run and ⌘0 to switch to the project window (provided you are using a GUI such as MacVim) as well as many others help to integrate Xcode and Vim.
3. Methods, functions, and #pragma marks for the current file can be listed and navigated to with the :ListMethods command.
4. A template of methods declared in a header file (.h) can be built in an implementation file (.m) with :BuildMethods.
5. Cocoa and C Documentation can be looked up with the :CocoaDoc command, or with Vim's K.
6. Code completion for classes, methods, functions, constants, types, and notifications can be invoked with <c-x><c-o>. Parameters for methods and functions are automatically converted to snippets to <tab> over if snipMate is installed.

Although cocoa.vim is usable, it is still very much in the beta stage. In particular, code completion still needs much work to match Xcode's editor. Also, if anyone has suggestions as for how to add breakpoints or lookup header definitions from within Vim I would very much appreciate it.

Bug reports can be submitted on the issue tracker: http://code.google.com/p/cocoa-dot-vim/issues/list
Development can be followed on GitHub: http://github.com/msanders/cocoa.vim

Hope you find it useful!
 
install details
unzip cocoa.zip -d ~/.vim
:helptags ~/.vim/doc (to enable the help)

Documentation lookup and code completion for Cocoa.vim are currently Leopard-only (although the other parts should work on any platform).

To replace Xcode's editor with MacVim: In Xcode, go to Preferences > File Types, then expand file -> text. Click on the second column ("Preferred Editor") of the "source code" entry, select "External editor -> other" and navigate to MacVim.

The code completion in cocoa.vim uses snipMate (vimscript#2540), if it is installed, to allow you to conveniently <tab> over the parameters in functions and methods, so it is recommended you install that as well if you want to get the most out of this plugin.

Lastly, since cocoa.vim opens Cocoa documentation in the browser, you may want to see this page to remove the annoying Leopard security alert: http://tinyurl.com/remove-annoying-alert
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cocoa.zip 0.4 2010-03-31 7.0 Michael Sanders Many bug fixes and miscellaneous improvements.
cocoa.zip 0.3 2009-12-28 7.0 Michael Sanders Fixed a number of bugs, and added support for the iPhone SDK and Snow Leopard.
cocoa.zip 0.2 2009-07-01 7.0 Michael Sanders Many, many bug fixes and improvements, including multi-line message highlighting, multi-line documentation message lookup, automatic detection of ivar classes for completion, support for #pragma marks in :ListMethods, and many other things.
cocoa.zip 0.1 2009-06-13 7.0 Michael Sanders Initial upload
ip used for rating: 54.82.170.223

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo