If you are one of thousands of TextMate fans, you are probably addicted to its bundles. We have created the Snippets bundle as well. Currently, it allows to create snippets from text selection. Bundle uses snippet: URI scheme to add snippets into the Library.
Download the sugar, unarchive and double-click it, TextMate will do the rest.
An alternative way to install Snippets bundle is running these three commands in Terminal App (located at /Applications/Utilities/Terminal)
mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/snippets/Snippets-tmbundle Snippets.tmbundle
If you have installed the bundle directly from GitHub you have to run these commands to update bundle.
cd ~/Library/Application\ Support/TextMate/Bundles/Snippets.tmbundle
git pull
Select a piece of code you'd like to create a snippet from and press Command-Shift-P. (you can change this shortcut via TextMate bundle editor).
You can also set some environment variables to define default attributes in the newly created snippets.
Use Preferences→Advanced→Shell Variables window to set them up:
Bundle will automatically define Highlight for snippet depending on what kind of file is being edited (scope selector). If you create a snippet from the selection in a file located in your file fystem, the Bundle will also auto-assign 'File Name for Export' and 'Related URL' fields.