Inserting space before parens in Xcode


#1

Hey everybody! I've got a Juce-related code-formatting issue (stop groaning, it's not that bad). 

I like the Juce convention of inserting a space before opening parentheses. Unfortunately this is a bit at odds with the way Xcode likes to format things when it tries to help you complete function calls. 

Is there any way to get Xcode to insert a space before parens automatically? It would save me a lot of reaching for the mouse, but can't seem to find an option for this anywhere. 

nick

 


#2

Perhaps this

Can be modified to do that.

Rail


#3

interesting, i may check that out. thanks! wish there was some native way to do this but so far I'm coming up short.


#4

Is there any way to get Xcode to insert a space before parens automatically?

This also bothers me quite a lot. I neither found a solution yet.

My workaround - no evangelism intended:
I have added the key binding 'Alt-Command-E' for 'Open in external editor' to XCode. My weapon of choice is MacVim + YouCompleteMe. With this you can add a space before an opening parentheses and still get code completion. You also can split horizontal and vertical and edit multiple files with ease, and you get a ton of other powerful vim features.
http://www.juce.com/comment/308777#comment-308777

 

@Jules:
May you share your workflow about how you deal with adding spaces in front of parentheses in XCode? Has Juce mainly been written in XCode or do you use a dedicated text editor?


#5

@Jules:
May you share your workflow about how you deal with adding spaces in front of parentheses in XCode? Has Juce mainly been written in XCode or do you use a dedicated text editor?

I mainly use Xcode these days, but never attempted to make it automatically do the spacing - I just spend a lot of time nudging things around manually!


#6

I'm also a VIM user these days, feel handicapped coding without it! 

MacVim, YouCompleteMe + Syntastic, plus Command-T are the main plugins that help my coding flow.

Recommended if you have the time to learn the basics of VIM:

  • type 'vimtutor' and complete the exercises a few times. 
  • use Vundle or similar plugin manager
  • once you've got the basics read http://www.slideshare.net/andreizm/vim-for-php-programmers-pdf