How to use a custom text editor (like Emacs.app or MacVim) in Xcode 4?
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.


Right click on a source file
Select "Get Info"
Expand the "Open With:" section and select your preferred text editor to something other than Xcode.
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.