Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the way Xcode indents comment blocks?

By default, Xcode automatically indents multiple lines of code within C-style comment blocks by one space:

/* this is a comment block
 line 1
 line 2
*/

Is it possible to modify this behaviour? I would prefer to have no indentation within comment blocks.

like image 607
e.James Avatar asked Feb 07 '10 22:02

e.James


People also ask

How do I indent multiple lines in Xcode?

Select the lines and press Ctrl + i from keyboard. You will have the lines indented. Save this answer.

How do I comment out lines in Xcode?

6. Comments By selecting a few lines of code (pressing ⇧+↑ or ⇧+↓), you can comment a bunch of lines in a single shot with the ⌘ + / shortcut. If the lines are already comments, the same shortcut will uncomment them.

How do I indent a block of code in Xcode?

Xcode can fix this with one shortcut: select the code you want to fix, then press Ctrl+I to reindent it.


1 Answers

This is not a complete answer, but Xcode has code formatting options under the key XCCodeSenseFormattingOptions.

You can set the options via command line or by editing the plist:

defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict PreExpressionsSpacing  "" PreCommaSpacing " "

Unfortunately, I cannot find any setting for the one space indentation in comment blocks, and it makes me crazy!

like image 186
dodgio Avatar answered Oct 02 '22 08:10

dodgio