Customizing Xcode Text Macros
Students in our classes often ask how to customize Xcode’s text macros for block structured statements (e.g., method and function bodies, bodies of if, for, and while statements, etc.) in order to push the opening curly brace to the next line. Here’s a little command-line fu using OS X’s defaults mechanism:
defaults write com.apple.Xcode XCCodeSenseFormattingOptions '{ "BlockSeparator" = "\n" ; }'
This tells Xcode to use a newline character as the ‘block separator’ between the opening curly brace and whatever preceded it.
Advertisement
Does not work in Xcode 4. I also tried…
defaults write com.apple.dt.Xcode XCCodeSenseFormattingOptions ‘{ “BlockSeparator” = “\n” ; }’
(note the “dt”)
…which also did not work. Any ideas?