How to insert text with a custom TextMate Bundle snippet

As a quick note to self, I just created a TextMate Bundle snippet to insert some text at the current cursor position. Using TextMate 2.0.x, I did it with the following steps. I’ll go through these steps quickly as I’m just writing this for myself:

  • Open TextMate
  • Select the Bundles menu, then Edit Bundles

This displays a new dialog. Since I already have a bundle named “Alvin’s Bundles,” I just add my snippet to that bundle like this:

  • Select that bundle
  • Select Menu Actions
  • Go up to the menubar and select File, then New

This brings up a new dialog. Select Snippet on this dialog, then click Create.

Now, just put the code in the textarea that you want to have inserted. With a snippet you don’t need to write any code or anything, just put your text in here. In my case the Markdown comment syntax is a little bizarre looking, so I insert it here (because I can’t remember it):

[//]: # (COMMENT)

Now, give the snippet a name in the “Name:” field. This name will appear in the TextMate Bundles menu, so make it something meaningful to you.

Finally, press [Command][s] to save the snippet, and you should be good to go.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.