SubEthaEdit + Snippets = Love

Comments

The pkrll that was mentioned (unauthenticated)
Jan 27, 2010

Oh, exiciting.

/groups/christofferwinterkvist/search/index.rss?tag=hotlist/groups/christofferwinterkvist/search/?tag=hotWhat’s HotHotListHot!?tag=hot12/groups/christofferwinterkvist/sidebar/HotListchristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:53+00:002010-03-28 17:07:53updated23Added tag - selectionschristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:46+00:002010-03-28 17:07:46addTag22Added tag - wrap inchristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:38+00:002010-03-28 17:07:38addTag21Added tag - selectionchristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:37+00:002010-03-28 17:07:37addTag20Added tag - projectschristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:32+00:002010-03-28 17:07:32addTag19Added tag - snippetschristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:30+00:002010-03-28 17:07:30addTag18Added tag - scriptschristofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:28+00:002010-03-28 17:07:28addTag17christofferwinterkvistChristoffer Winterkvist2010-03-28 17:07:21+00:002010-03-28 17:07:21updated16christofferwinterkvistChristoffer Winterkvist2010-03-28 17:03:23+00:002010-03-28 17:03:23updated15christofferwinterkvistChristoffer Winterkvist2010-03-25 17:31:19+00:002010-03-25 17:31:19updated14christofferwinterkvistChristoffer Winterkvist2010-03-25 17:30:24+00:002010-03-25 17:30:24updated13christofferwinterkvistChristoffer Winterkvist2010-03-25 17:28:33+00:002010-03-25 17:28:33updated12Added tag - subethaeditchristofferwinterkvistChristoffer Winterkvist2010-01-19 12:46:17+00:002010-01-19 12:46:17addTag11christofferwinterkvistChristoffer Winterkvist2010-01-19 11:58:52+00:002010-01-19 11:58:52updated10christofferwinterkvistChristoffer Winterkvist2010-01-19 11:58:37+00:002010-01-19 11:58:37updated9christofferwinterkvistChristoffer Winterkvist2010-01-19 11:57:57+00:002010-01-19 11:57:57updated8christofferwinterkvistChristoffer Winterkvist2010-01-19 11:57:19+00:002010-01-19 11:57:19updated7christofferwinterkvistChristoffer Winterkvist2010-01-19 11:21:59+00:002010-01-19 11:21:59updated6christofferwinterkvistChristoffer Winterkvist2010-01-19 11:21:24+00:002010-01-19 11:21:24updated5christofferwinterkvistChristoffer Winterkvist2010-01-19 09:01:40+00:002010-01-19 09:01:40updated4Added tag - hotchristofferwinterkvistChristoffer Winterkvist2010-01-19 09:01:38+00:002010-01-19 09:01:38addTag3christofferwinterkvistChristoffer Winterkvist2010-01-19 09:00:00+00:002010-01-19 09:00:00updated2First createdchristofferwinterkvistChristoffer Winterkvist2010-01-19 08:45:02+00:002010-01-19 08:45:02created1wiki2010-03-28T17:07:53+00:00groups/christofferwinterkvist/wiki/743d7FalseSubEthaEdit - Scripts/groups/christofferwinterkvist/wiki/743d7/SubEthaEdit__Scripts.htmlChristoffer Winterkvist23 updatesSubEthaEdit - Scripts Information Note that the script don't have any keybindings, binding the scripts can be done either by editing the scripts themselves or b...Falsechristofferwinterkvist2010-03-28T17:07:53+00:00christofferwinterkvistChristoffer Winterkvist2010-03-26 06:45:26+00:002010-03-26 06:45:26updated9christofferwinterkvistChristoffer Winterkvist2010-03-26 06:41:17+00:002010-03-26 06:41:17updated8christofferwinterkvistChristoffer Winterkvist2010-03-26 06:39:49+00:002010-03-26 06:39:49updated7Added tag - hotchristofferwinterkvistChristoffer Winterkvist2010-03-26 06:39:49+00:002010-03-26 06:39:49addTag6Added tag - youtubechristofferwinterkvistChristoffer Winterkvist2010-03-26 06:36:45+00:002010-03-26 06:36:45addTag5Added tag - misc bundlechristofferwinterkvistChristoffer Winterkvist2010-03-26 06:28:29+00:002010-03-26 06:28:29addTag4Added tag - scriptschristofferwinterkvistChristoffer Winterkvist2010-03-26 06:28:18+00:002010-03-26 06:28:18addTag3Added tag - subethaeditchristofferwinterkvistChristoffer Winterkvist2010-03-26 06:28:16+00:002010-03-26 06:28:16addTag2First createdchristofferwinterkvistChristoffer Winterkvist2010-03-26 06:28:08+00:002010-03-26 06:28:08created1weblog2010-03-26T06:45:26+00:00groups/christofferwinterkvist/weblog/f47faFalseSubEthaEdit - Insert Multiple/groups/christofferwinterkvist/weblog/f47fa/SubEthaEdit__Insert_Multiple.htmlChristoffer Winterkvist9 updatesSubEthaEdit - Insert Multiple Hi folks! I Just made a small "screencast" showing the Insert Multiple.scpt which is included in Misc version 2.0.zip. By default SubEthaEdit has...Falsechristofferwinterkvist2010-03-26T06:45:26+00:00Added tag - snippetschristofferwinterkvistChristoffer Winterkvist2010-03-23 09:34:07+00:002010-03-23 09:34:07addTag7christofferwinterkvistChristoffer Winterkvist2010-03-23 07:17:28+00:002010-03-23 07:17:28updated6Added tag - version 2.0christofferwinterkvistChristoffer Winterkvist2010-03-23 07:17:18+00:002010-03-23 07:17:18addTag5Added tag - scriptschristofferwinterkvistChristoffer Winterkvist2010-03-23 07:17:14+00:002010-03-23 07:17:14addTag4Added tag - subethaeditchristofferwinterkvistChristoffer Winterkvist2010-03-23 07:17:11+00:002010-03-23 07:17:11addTag3Added tag - hotchristofferwinterkvistChristoffer Winterkvist2010-03-23 07:17:08+00:002010-03-23 07:17:08addTag2First createdchristofferwinterkvistChristoffer Winterkvist2010-03-23 07:10:28+00:002010-03-23 07:10:28created1weblog2010-03-23T07:17:28+00:00groups/christofferwinterkvist/weblog/e22ecFalseSubEthaEdit Scripting version 2 coming soon/groups/christofferwinterkvist/weblog/e22ec/SubEthaEdit_Scripting_version_2_coming_soon.htmlChristoffer Winterkvist7 updatesSubEthaEdit Scripting version 2 coming soon Hi folks, It's been awhile since I last updated my blog... I just wanted to inform you that version 2 of my SubEthaEdit scripts are almost ready to...Falsechristofferwinterkvist2010-03-23T07:17:28+00:00christofferwinterkvistChristoffer Winterkvist2010-01-28 10:04:38+00:002010-01-28 10:04:38updated6Added tag - snippetschristofferwinterkvistChristoffer Winterkvist2010-01-28 10:02:58+00:002010-01-28 10:02:58addTag5Added tag - codingchristofferwinterkvistChristoffer Winterkvist2010-01-28 10:02:57+00:002010-01-28 10:02:57addTag4Added tag - subethaeditchristofferwinterkvistChristoffer Winterkvist2010-01-28 10:02:54+00:002010-01-28 10:02:54addTag3Added tag - hotchristofferwinterkvistChristoffer Winterkvist2010-01-28 10:02:52+00:002010-01-28 10:02:52addTag2First createdchristofferwinterkvistChristoffer Winterkvist2010-01-28 09:56:00+00:002010-01-28 09:56:00created1weblog2010-01-28T10:04:39+00:00groups/christofferwinterkvist/weblog/78aa8FalseSubEthaEdit + Snippets = Love : Part 2/groups/christofferwinterkvist/weblog/78aa8/SubEthaEdit__Snippets__Love__Part_2.htmlChristoffer Winterkvist6 updatesSubEthaEdit + Snippets = Love : Part 2 My Snippet engine is really coming along nicely, I just did some refactoring which resulted in me using SimpleXML instead of DOMDocument. At first gl...Falsechristofferwinterkvist2010-01-28T10:04:39+00:00christofferwinterkvistChristoffer Winterkvist2010-01-27 06:42:38+00:002010-01-27 06:42:38updated12christofferwinterkvistChristoffer Winterkvist2010-01-27 06:42:13+00:002010-01-27 06:42:13updated11christofferwinterkvistChristoffer Winterkvist2010-01-27 06:40:19+00:002010-01-27 06:40:19updated10christofferwinterkvistChristoffer Winterkvist2010-01-27 06:39:53+00:002010-01-27 06:39:53updated9christofferwinterkvistChristoffer Winterkvist2010-01-27 06:37:24+00:002010-01-27 06:37:24updated8christofferwinterkvistChristoffer Winterkvist2010-01-27 06:37:02+00:002010-01-27 06:37:02updated7christofferwinterkvistChristoffer Winterkvist2010-01-27 06:36:18+00:002010-01-27 06:36:18updated6Added tag - editorchristofferwinterkvistChristoffer Winterkvist2010-01-27 06:28:28+00:002010-01-27 06:28:28addTag5Added tag - codingchristofferwinterkvistChristoffer Winterkvist2010-01-27 06:28:26+00:002010-01-27 06:28:26addTag4Added tag - subethaeditchristofferwinterkvistChristoffer Winterkvist2010-01-27 06:28:21+00:002010-01-27 06:28:21addTag3Added tag - hotchristofferwinterkvistChristoffer Winterkvist2010-01-27 06:28:18+00:002010-01-27 06:28:18addTag2First createdchristofferwinterkvistChristoffer Winterkvist2010-01-27 06:09:41+00:002010-01-27 06:09:41created1weblog2010-01-27T06:42:38+00:00groups/christofferwinterkvist/weblog/d1ceeFalseSubEthaEdit + Snippets = Love/groups/christofferwinterkvist/weblog/d1cee/SubEthaEdit__Snippets__Love.htmlChristoffer Winterkvist12 updatesSubEthaEdit + Snippets = Love Yesterday I managed to add snippets support to SubEthaEdit by using AppleScript, PHP and XML. I'm planning on making this available to everybody who ...Falsechristofferwinterkvist2010-01-27T06:42:38+00:00hot/groups/christofferwinterkvist/search/index.rss?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcomelist/groups/christofferwinterkvist/search/?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcomeRecent ChangesRecentChangesListUpdates?sort=modifiedDate&kind=all&sortDirection=reverse&excludePages=wiki/welcome0/groups/christofferwinterkvist/sidebar/RecentChangesListmodifiedDateallRecent ChangesRecentChangesListUpdateswiki/welcomeNo recent changes.reverse5search
Yesterday I managed to add snippets support to SubEthaEdit by using AppleScript, PHP and XML. I'm planning on making this available to everybody who wants it but I need to do some refactoring before a release is possible. PHP is not the best language to use + I'm using DOMDocument to parse the snippet storage file. DOMDocument is not apart of the standard PHP installation on OS X Snow Leopard.

Yeah I know, there are snippet apps out there that store snippets and what not but the problem is that when pasting them into SubEthaEdit the indentation gets all screwy. I managed to work around this by returning "perfectly" formatted source when calling a tabbed trigger.

As mentioned above you store the snippets in XML-files. The script is dependent on which Mode your are currently using, for example: if you are using PHP-HTML the script parses PHP-HTML.xml.

This is an extract from PHP-HTML.xml

<completion string="if">
<snippet>if (@:statement) {

} </snippet> </completion>
String is the tab-trigger (in this case 'if').
@: is the placeholder to where the cursor should go after execution and statement is in this case a dummy text (dummy text gets selected if it is connected to the placeholder).

At this time it is only possible to use one placeholder per snippet, you could add more if you wanted to but it would only work "auto-magically" with the first occurring placeholder.
I'm gonna look into this more in the future but for now I'm gonna focus on the refactoring.

I have some other plans as well but I'll tell you more about them later !

Sidenote
I would like to thank pkrll for all his moral support!