Add Xcode Text Macros

File this under “I hope there’s a better way, but this is how I did it”:

  1. spotlight search for xctxtmacro.
  2. Open C.xctxtmacro (mine opened with textedit)
  3. go to the end and copy and paste the “c.separatorcomment” block
  4. massage new entry accordingly
  5. restart Xcode
  6. use new text macro

I recommend three different ways for executing your macro, I make use of all three:

  1. Xcode’s key bindings preference pane (recommended for frequently used macros)
  2. Xcode’s autocomplete. Just type the macro’s “CompletionPrefix” and it should popup.
  3. Gus’ Menu Accelerator. Highly recommended. Watch his video.

5 Responses to “Add Xcode Text Macros”

  1. tyler Says:

    thanks! I was trying to figure out how to do this. Why don’t they document it?! Crazy!

    thanks.

  2. John Wylie Says:

    I use macros alot, and not always in xcode.

    I have written a global macro tool that can be used in any editor, and i also released a set of new xcode macros: http://activata.co.uk/xcodemacros/

  3. SSteve Says:

    You’ve probably figured it out by now, but there is a better way.There’s a free chapter from the book “Beginning Xcode” (http://www.wrox.com/WileyCDA/WroxTitle/productCd-047175479X.html) that describes the file format. Click “Download Code” then download the “Bonus Sections Disk Image”. The only problem with the document is that the folder in which the author tells you to put your xctxtmacro file no longer works with Xcode 2.5 (and presumably 3.0). The correct folder is ~/Library/Application Support/Developer/Shared/Xcode/Specifications.

  4. Matthew Delfino Says:

    An additional quick tip for Xcode 3.0 - Under the Scripts > Comments > Un/Comment Selection, we have a perl script that checks for the type of file you are working in and comments appropriately. I am indulging in Ruby right now and this script does not allow for Ruby, which comments just like shell and Perl. So, if you choose to Edit Scripts under the script menu and go to this script, replace line 19 as follows:

    Instead of:
    if ($fileString =~ m!^($perlCmt|$cCmt)?#!\s.?/perl|^($perlCmt|$cCmt)?#!\s.?/sh!) {

    Try this:
    if ($fileString =~ m!^($perlCmt|$cCmt)?#!\s.?/(perl|ruby)|^($perlCmt|$cCmt)?#!\s.?/sh!) {

    (no carriage returns added and I have no idea how much of this syntax will display in my comment - sorry in advance)

    It makes commenting and uncommenting my Ruby scripts much, much easier.

  5. emil Says:

    anyone - make a a text macro editor, or else I will try. after all, we’re all using xcode… start working ;)

Leave a Reply


© 2006 roobasoft, LLC