Advanced Features

Snippet Nesting

Snippet Monkey supports calling snippets from inside of other snippets. It's as simple as placing curly braces around the snippets name and placing the the string in the calling snippet contents. For instance, to call the "Monkey" example snippet from another snippet you could create a snippet like this :

1: Hi. I'm a Snippet and I'm gonna call the monkey snippet
2: {mmo}

Snippet Nesting is a powerful feature and can be used to create email templates etc...

Sniplets

Sniplets are a Snippet Monkey first and can not be found in any competing applications. Sniplets are snippets that take arguments and you have access to those arguments from within your Snippets. It adds a whole new dimension to typing accelerator utilities. Snippet Monkey includes a sample Sniplet called Letter Template Snippet. We'll use that to explain the feature. The contents of Letter Template Snippet look like this :

1: {ddate}
2:
3: Hello {0},
4:
5: Doesn't {1} kick butt ?
6:
7: Sincerely,
8:
9: {2}

From our discussion on snippet nesting, you'll notice line 1 is doing nothing more than calling the Snippet that has shortcut ddate. The new items here are on line 3, 5 and 9. On these lines we see a number inside curly braces ie {0}. These numbers are placeholders for arguments passed into the Snippet from left to right. You'll also notice the indexing is 0 based. In other words, 0 is the first item, 1 is the second etc... Whereever these items exist, Snippet Monkey will substitute the argument for the number.

Ex : Letter Head Example Sniplet

Using Sniplets are as easy as any other Snippet, but there are some special requirements for defining and using them.

Requirement 1 : Any snippet you want to pass arguments to HAS to have the string ">.<" at the end of its shortcut.

Ex : If you wanted to have a sniplet called narf that took arguments, the shortcut string would look like this :
1: narf>.<
Requirement 2 : When typing out sniplets. You are required to bracket and comma delimit any arguments passed to the Sniplet like so :
1: lh>David,Snippet Monkey,Podiesh<

Below is a table showing the resulting output ( left ) from running the above sniplet and the source sniplet ( right ) :

1: Sunday October 15, 2006
2:
3: Hello David,
4:
5: Doesn't Snippet Monkey kick butt ?
6:
7: Sincerely,
8:
9: Podiesh
Output of lh>David,Snippet Monkey,Podiesh<
1: {ddate}
2:
3: Hello {0},
4:
5: Doesn't {1} kick butt ?
6:
7: Sincerely,
8:
9: {2}
Source to lh>.< Snippet
The snippet above is an example snippet included with Snippet Monkey. You can try it out now. Simply type "lh>Me,Snippet Monkey,Me<" in the text area below1.



1 These examples will not work unless Snippet Monkey is running.