View Full Version : How to open 'square brackets' in XCode faster?
Jun 22, 2008, 06:21 AM
Is there a macro that opens square brackets in XCode?
For example, suppose that my cursor is at <cursor> in the following code:
And after a key shortcut I get the following code:
Is this possible?
Jun 22, 2008, 01:40 PM
Not that I'm aware of, but that's a good idea :)
Jun 22, 2008, 04:31 PM
There is an integrated scripting utility that lets you write complex scripts and assign them shortcut key combos in Xcode. Unfortunately I am poolside with my work DELL Craptop so I can't go through the motions.
Basically anyone good with shell scripting should be able to make or adopt an existing shell script to put an open [ at the beginning of the current line and/or selection and put a closing ] at the end of the line.
Jun 22, 2008, 05:33 PM
^^ That's not exactly what you want, you want it to put it at the beginning of the current  block...
Jun 22, 2008, 05:54 PM
You might want to give a look at TextMate's Objective-C bundle scripts.
Jun 23, 2008, 12:54 AM
Hmm. The scripting cabability XCode provides appears to be too heavy for such a small task. What do you think? We have to write a (say, python) script that takes the whole text file as input, right? And I guess we need two things: 1. Get the current location of the cursor, 2. Change the current location of the cursor.