How to open 'square brackets' in XCode faster?

Discussion in 'Mac Programming' started by bengimizrahi, Jun 22, 2008.

  1. macrumors newbie

    bengimizrahi

    Joined:
    May 24, 2008
    Location:
    Istanbul
    #1
    Is there a macro that opens square brackets in XCode?

    For example, suppose that my cursor is at <cursor> in the following code:

    [foo method]<cursor>;

    And after a key shortcut I get the following code:

    [[foo method]<cursor>];

    Is this possible?
     
  2. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
    Not that I'm aware of, but that's a good idea :)
     
  3. macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #3
    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.
     
  4. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #4
    ^^ That's not exactly what you want, you want it to put it at the beginning of the current [] block...
     
  5. macrumors regular

    Joined:
    Jan 19, 2006
    #5
    You might want to give a look at TextMate's Objective-C bundle scripts.
     
  6. thread starter macrumors newbie

    bengimizrahi

    Joined:
    May 24, 2008
    Location:
    Istanbul
    #6
    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.
     

Share This Page