cxcodeindentation

In Xcode, how to disable the handling of macros for indentation?


In Xcode 4.0, by default, the indentation is like below:

#ifdef SYNTHETIC
    char buff_inarray[100];
#else
    char buff_in;
#endif

However, I want it to be the simpler version, like:

    #ifdef SYNTHETIC
    char buff_inarray[100];
    #else
    char buff_in;
    #endif

How to set it?


Solution

  • You can't modify Xcode indentation settings. You'll have to either use a different editor and re-indent all code yourself.

    Maximum you can do, is disable autoindent. It is done in Xcode's preferences → Text Editing → Indentation. This pic is from Xcode 5, but I'm pretty sure version 4 had it there as well.

    Autoindent settings

    Also, it is a common coding convention to use preprocessor macros from column 0, all programmers would expect it be there. The reason being it's not code itself (which should be indented), it is which code is to be compiled.