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.
Select the lines and press Ctrl + i from keyboard. You will have the lines indented. Save this answer.
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.
Xcode can fix this with one shortcut: select the code you want to fix, then press Ctrl+I to reindent it.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With