Is it possible to set indent settings in Xcode per project (or per file, even)?

醉酒当歌 提交于 2019-11-30 06:01:44
Steven Kramer

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.

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'.

The accepted answer is no longer correct.. as of Xcode 5.1.. which forces you now to Edit "per file" indentation settings via..

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:

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!