Sublime Forum

Adding a snippet

#1

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?

0 Likes

#2

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 sublimetext.info/docs/en/extensi … tions.html, and you can look at Packages/HTML/HTML.sublime-completions for an example.

0 Likes

#3

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

0 Likes