A script that partially mimics TextMate's snippets feature

Help with writing and running scripts

A script that partially mimics TextMate's snippets feature

Postby scallanh » Tue Aug 11, 2009 3:31 pm

I've written a script that partially mimics the snippets feature from TextMate (it's also found in few other editors like NetBeans):

http://www.ultraedit.com/files/scripts/snippets.js

It doesn't have all of TextMate's advanced snippets functionality, it just replaces the keyword under the cursor with a snippet (preserving the indentation), and optionally moves the cursor to somewhere in the snippet. I've sent a request to IDM to add a full snippets feature, and I suggest you do the same.

The default snippets are ones I like to use for HTML/PHP/JavaScript, but you can easily change or replace those with whatever works for you. Also, the default snippets contain tabs which you may want to replace with spaces if that's what you use for indentation.

Cheers,
Sean
User avatar
scallanh
Basic User
Basic User
 
Posts: 31
Joined: Mon Oct 24, 2005 11:00 pm

Re: A script that partially mimics TextMate's snippets feature

Postby drcurl » Tue Aug 11, 2009 10:26 pm

Thank you for the script.
drcurl
Newbie
 
Posts: 3
Joined: Mon Apr 06, 2009 8:29 pm

Re: A script that partially mimics TextMate's snippets feature

Postby fan.of.dilbert » Wed Jan 20, 2010 9:02 pm

Sean:

I had messed around with the Zen Coding and happened to see your post mentioning your script and I'm so glad I did. I really like it and find myself using it all the time now. Although Zen Coding has some powerful stuff for certain coding, I like your setup which seems easier to create well formatted multi-line replacements.

The ^ for user choice of where to insert the cursor after text replacement is super.

Awesome job!

Doug
User avatar
fan.of.dilbert
Newbie
 
Posts: 4
Joined: Sat Aug 08, 2009 2:28 pm
Location: USA


Return to Scripts