Xcode macros
Here’s a cool Xcode trick that I never knew it could do. Type any of the prefixes below and then type control-. (period) to expand them to the full text. Control-/ will then select the next placeholder like it does for code completion. This is a really cool feature. Now I just have to remember all of the prefixes. Thanks go out to Scott for pointing it out.
Obj-C
@try == Try / Catch Block @catch == Catch Block @finally == Finally Block log == NSLog() Call a == Alloc / Init Call aa == Array Declaration ma == Mutable Array Declaration fora == Array For Loop init == Init Method Definition dealloc == Dealloc Method Definition nss == NSString nsms == NSMutableString nsma == NSMutableArray nsd == NSDictionary nsmd == NSMutableDictionary
C
if == If Block ifelse == If / Else Block elseif == Else If Block for == For Loop fori == For i Loop while == While Loop do == Do While Loop switch == Switch Block case == Case Block else == Else Block enum == Enum Definition struct == Struct Definition union == Union Definition typedef == Type Definition printf == Printf() Call pm == #Pragma Mark pim == #Import Statement (System) pimf == #Import Statement (Framework) pin == #Include Statement pins == #Include Statement (System) pif == #If Block pifd == #Ifdef Block pife == #If / Else Block pifde = #Ifdef / Else Block pifz == #If 0 Block copyright == Copyright Comment comment == Comment Selection cseparator == Separator Comment
C++
pifdcpp == #Ifdef __cplusplus Block pifdecpp == #Ifdef _cplusplus / Else Block static_cast == Static Cast dynamic_cast == Dynamic Cast reinterpret_cast == Reinterpret Cast try == Try / Catch Block catch == Catch Block cout == Cout Statement coutm == Cout Message namespace == Namespace Definition class == Class Definition extern == Extern \"C\" Statement externb == Extern \"C\" Block
Java – note: many of the C/C++ macros work for Java
try == Try / Catch Block catch == Catch Block finally == Finally Block println == Println() Call synchronized == Synchronized Block
HTML
b == Bold i == Italics u == Underline big == Bigger small == Smaller title == Title strike == Strikethrough sub == Subscript sup == Superscript tt == Typewriter Text code == Code center == Center h1 == Heading 1 h2 == Heading 2 h3 == Heading 3 h4 == Heading 4 h5 == Heading 5 h6 == Heading 6 hr == Horizontal rule a == Link at == Link With Target aa == Anchor ol == Ordered List ul == Ordered List li == List Item
I have built a tool for creating you own macros that work in any editor, and released a new set of macros for xcode: http://activata.co.uk/xcodemacros/
Cool!