diff --git a/MyMacros.xctxtmacro b/MyMacros.xctxtmacro index c71970d..f1978f8 100644 --- a/MyMacros.xctxtmacro +++ b/MyMacros.xctxtmacro @@ -27,6 +27,49 @@ TextString = "@\"<#!string!#>\""; OnlyAtBOL = NO; }, + { + Identifier = objc.nsstring; + BasedOn = objc; + IsMenuItem = YES; + CompletionPrefix = "nss"; + Name = "NSString *"; + TextString = "NSString *"; + OnlyAtBOL = NO; + }, + + +/* ********************************************************* + * Containers + * *********************************************************/ + + { + Identifier = objc.array.mutable; + Name = "NSMutableArray *"; + IsMenuItem = YES; + BasedOn = objc; + CompletionPrefix = nsma; + TextString = "NSMutableArray *"; + OnlyAtBOL = YES; + }, + { + Identifier = objc.array.mutable; + Name = "NSMutableArray *"; + IsMenuItem = YES; + BasedOn = objc; + CompletionPrefix = nsma; + TextString = "NSMutableArray *"; + OnlyAtBOL = NO; + }, + + { + Identifier = objc.array.mutable.array; + Name = "NSMutableArray array"; + IsMenuItem = YES; + BasedOn = objc; + CompletionPrefix = nsmaa; + TextString = "[NSMutableArray array]"; + OnlyAtBOL = NO; + }, /* ********************************************************* * Properties diff --git a/README.md b/README.md index 78c5465..7119eec 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,9 @@ adding your macros, and sending me a pull request. There is also a cheat sheet generator that lists the macros on an HTML page with their completion prefixes and your keybord shortcuts. -[Here’s an example](http://www.entropy.ch/software/macosx/xcode-macro-cheat-sheet.html). -You’re more than welcome to spice up that HTML in the XSLT:-) +[Here’s an example](http://www.entropy.ch/software/macosx/xcode-macro-cheat-sheet.html) +with my particular keyboard shortcuts. You’re more than welcome to +spice up that HTML in the XSLT :-) About Xcode’s Text Macros in General @@ -27,15 +28,19 @@ with a nice space-saving icon like the one [BBEdit](http://www.barebones.com/products/bbedit/) uses for its clippings. Xcode’s macro system is very powerful. The first step to harnessing that power -for your daily coding is to start using the macros that are already in Xcode: +for your daily coding is to start using the macros that are already there: * Assigning keyboard shortcuts to the most often used ones is *highly* recommended, especially to get one of the coolest macro features, cycle lists. Cycle lists link together related macros and let you - quickly flip through them by repeatedly pressing the shortcut. This - is very useful for variants of similar constructs such as `if ()` statements - or method definitions, for example. Until recently I didn’t know about - cycle lists. The cheat sheet shows you which macros are part of a cycle list. + quickly flip through them by repeatedly pressing the shortcut. While + Xcode switches from variant to variant, it preserves your wrapped + selected text (see next item) and replaces just the macro code around + it. + Cycle lists are useful for variants of similar constructs such as `if ()` + statements or method definitions. Until recently I didn’t know about + cycle lists. The cheat sheet shows you which macros are grouped together + in such a list. * Another great feature that’s easier to use with keyboard shortcuts is the ability of some macros to wrap selected text. Again this is useful for block statements such as `if ()`, especially in combination with the previous @@ -123,6 +128,27 @@ Inserts `[NSString stringWithFormat:...]` with a format string and arguments pla Recommended shortcut: ⌃F +Containers +------- + +### NSMutableArray + +Inserts `NSMutableArray *`. + +Recommended shortcut: use completion prefix `nsma` + +### NSMutableArray array + +Inserts `[NSMutableArray array]`. + +Recommended shortcut: use completion prefix `nsmaa` + +### NSString With Format + +Inserts `[NSString stringWithFormat:...]` with a format string and arguments placeholders. + +Recommended shortcut: ⌃F + NSLog() -------