How to make a HTML Skeleton Snippet in Textmate

July 21, 2011

I reformatted my Mac in anticipation for Lion on my Mac and forgot to backup my snippets. One of my favorites and most often used is my html skeleton (beginhtml) snippet (I took the name from Jeremy Wray of Nettus during a CodeIgnitor tutorial a while back).

Step 1. Copy the code below

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

   "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${1:$}</title>
$0
</head>
<body>

</body>
</html>


Step 2. In Textmate select bundles > bundle editor > edit snippets. Click on the + sign in the lower-left hand corner. Paste the code from above. Double Click on the currently highlighted snipped (it should be untitled and name it beginhtml (or whatever you want). Make sure that under activation it says “Tab Trigger”.

Step 3. Click on the close button, open a new textmate file (make sure it’s in Html editing mode). type in “beginhtml” and then tab.

So that’s pretty much it. Enjoy