How to use a custom text editor (like or MacVim) in Xcode 4


In Xcode 3 we could change file type settings, like indicated below:

Using External Text Editors with Xcode

There are lots of text editors available on Mac OS X. If you shelled
out good money for a text editor, you want to use it to edit your
source code instead of Xcode's editor. How do you tell Xcode to use
your desired text editor to edit your source code files?

Choose Xcode > Preferences to open Xcode's preferences window. There
is a toolbar at the top of the window with many buttons. Click the
File Types button. From here you can assign the editor to use for lots
of file types.

Initially there will be two items: file and folder. Click the
disclosure triangle next to file. Click the disclosure triangle next
to text because you're interested in text editing. The two most
interesting subcategories are sourcecode and scripts.

When you come across a file type you want to edit with your text
editor, select the Preferred Editor column for that file type. A menu
will pop up. Choose External Editor. If your text editor does not
appear in the submenu, choose Other. Navigate to the location of your
text editor, and click the OK button. Repeat these steps for every
file type you want to edit with your text editor.

Now when you double-click a source code file in Xcode's project
window, it will open in your text editor.

But there are no settings for using external editor with Xcode 4.

Is there any way to use custom text editors with Xcode (such as or MacVim)?

Best Answer

There is not really a setting with in Xcode 4 to configure external editors as there use to be in Xcode 3.

The workaround is to set up your preferred text editor to open the file types that you want. And then right click on a source file in Xcodes Project Navigator and select "Open with External Editor..."

This suggestion of using "Open with External Editor..." at first will probably just open in Xcode a standalone window, since by default Xcode will probably be set to the default application for opening programming source files.

Set up your preferred application/s to open source files with.

For example for each kind of source files such as .c .h .m you want to edit in your preferred editor. Open a Finder Window/s that contains each type of file you want to set your preferred editor for.

  1. Right click on a source file

  2. Select "Get Info"

  3. Expand the "Open With:" section and select your preferred text editor to something other than Xcode.

  4. Press the Change All... button.

Now when you select "Open with External Editor..." in Xcode it should open the source file in your preferred external editor.