Home Download Buy Blog Forum Support

Adding a snippet

Adding a snippet

Postby tsyroid on Fri Jul 01, 2011 4:05 am

Hi all,

Q: How do I add a snippet?

Comments:

I've searched everything I could find on adding/creating snippets, as I find I'm using them more and more every day. Much of the documentation references the "add snippet..." command on the tools menu. Mmmm. Do I perhaps have the lowly Chevy version instead of the Ferrari? Cuz it ain't on any menu I have here.

Perhaps a feature not implemented yet?

Currently I'm going to the Packages/User DIR, creating a new file, copy/paste if I have something close, create from scratch if I do not, name appropriately... Which gets old fast, and frankly, keeps me from making more snippets and using the feature as intended.

I'd sure like to have the "New Snippet..." command I see referenced here and there -- the one that opens a new file with the snippet framework in place.

Is there a rock I've missed looking under?
tsyroid
 
Posts: 15
Joined: Sun Jan 30, 2011 3:02 am

Re: Adding a snippet

Postby jps on Fri Jul 01, 2011 4:59 am

There's no Tools/New Snippet menu item yet, although it is on the todo list. There is such a menu item in Sublime Text 1, which the documentation will be referring to.

If you're making many snippets, then you may be better off using a .sublime-completions file, which allows many snippets to be defined within a single file. Snippets and completions work in a more or less identical way, although completions don't work with punctuation based triggers. There's some documentation on .sublime-completion files at http://sublimetext.info/docs/en/extensi ... tions.html, and you can look at Packages/HTML/HTML.sublime-completions for an example.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Adding a snippet

Postby tsyroid on Fri Jul 01, 2011 7:12 am

Thanks Jon.

That's all I was hunting for; will be patient and let you continue your efforts.

REALLY like your tweak to the "selected text highlight" in latest builds. Should keep me giddy for a spell...

Would like to help organize documentation when you're ready. Have some background in doing so.
Contact me off-list with people who are already working on the task (if any) and your visions; will do some homework from there...

/tom
tsyroid
 
Posts: 15
Joined: Sun Jan 30, 2011 3:02 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 16 guests