Is it possible to set indent settings in Xcode per project (or per file, even)?
Some projects I work in uses tab key settings that equate to 3 or 4 spaces and another wants actual tabs. Another mixes the 开发者_如何学Ctwo depending on directory.
Is there some way to set these settings per project, or even better, per file? If not, does someone have a clever way of dealing with this? (besides "just remember which setting you should use and change it before you start editing")
This seems to have changed with Xcode 4 ... if you click on a file, group or project, amongst the items in the Utilities bar (at the right-hand side, by default) is 'Text Settings'.
You can set indentation per file, group, project, or for all new projects, and for all but per file indentation, new source code files will inherit the indentation settings of the closest parent.
To set indentation per file, select the file in the Project Navigator, and set indentation in the File Inspector ▶ Text Settings.
To set indentation per group, select the group in the Project Navigator, and set indentation in the File Inspector ▶ Text Settings.
To set indentation per project, select the project in the Project Navigator, and set indentation in the File Inspector ▶ Text Settings.
To set default indentation for new projects, select Xcode ▶ Preferences... ▶ Text Editing ▶ Indentation:
The accepted answer is no longer correct.. as of Xcode 5.1.. which forces you now to Edit "per file" indentation settings via..
⇢
Update: This answer only applies to Xcode3. For newer versions, see James Turner's answer.
Yes, go to View > Text > Tab Settings...
There you specify the (file-specific) indentation settings which will be saved in the project.
Actually Alex Gray and James Turner are the most correct - XCode 5.1 allows you to modify the tab/indent from the File Inspector as you mention, but simply highlight the entire project and it will apply to everything within it (i.e. all files).
As of 8.3 you can still select project in the navigator and then change the tab/space indent option in the inspector. Worth mentioning though is that it will only change files in folders that have been added with "Create groups" selected instead of "Create folder references" which is the default.
精彩评论