When I go to Edit Bundles I can't figure out how to create a new snippet

link|improve this question
feedback

1 Answer

up vote 4 down vote accepted

TextMate 2 has not yet been released and is in an alpha state. The bundle editor is one of the areas that are very much not final.

While a proof-of-concept bundle editor is included, it is provisional, has some flaws, and not how we envision the final bundle editor to be.

These instructions are for Version 2.0 (8956), current as of January 20, 2012. Think before you down vote.


Select Bundles » Edit Bundles… in the TextMate 2 menu.

Select the bundle you want to add a snippet to, e.g. HTML. Press Cmd-N to create a new bundle item, and select Snippet.

enter image description here

It will be automatically added to the Menu Actions subsection. You can change its settings, such as keyboard shortcut, in the drawer, and its contents in the editor at the bottom.

enter image description here

Enter a tab trigger in you want a sequence of characters (e.g. snip), followed by pressing Tab to trigger the snippet, or assign a keyboard shortcut.

Scope Selector specifies in which scopes the snippet can be inserted using the trigger. To find out the scopes of your selected language, switch to a document with that syntax, and press Ctrl-Shift-P to show all applicable scopes below to cursor.

enter image description here

For example, if you want your snippet to be available anywhere in HTML documents, enter text.html.basic, or source.shell for shell scripts. You can enter multiple scopes, separated by comma, or only scope name prefixes (e.g. source) to apply to all matching source.* scopes.

For anything else, just look at all the other snippets you can access from that window and see how they achieve some desired behavior.

link|improve this answer
there isn't a + button – jshen Jan 20 at 16:58
@jshen Instructions are for TextMate 1... will check to see if I can do it in the 2 preview. – Daniel Beck Jan 20 at 17:02
@jshen Fixed it. – Daniel Beck Jan 20 at 17:18
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.