Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Snippet Not Working

Tags:

sublimetext3

I was just trying to make some snippets but I can't get any of them to work. Can anyone see what's wrong with this? I read their docs and thumbed some examples off the web but they don't work either. I've got it in my /sublime text 3/packages/user folder and it's named using convention myTest.sublime.snippet.

The snippet is:

<snippet>
    <content>
<![CDATA[
<!DOCTYPE html lang="en">
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <title>${1:test1|test2|test3} | $2</title>
    <meta name="viewport" content="width=device-width">
    <meta name="Description" lang="en" content="Description">
    <meta name="robots" content="index, follow">
    <meta name="robots" content="noodp, noydir">

    <!-- Twitter Bootstrap -->
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <script src="assets/js/respond.min.js"></script>
    <![endif]-->    
</head>
<body>

    <div class="container">
        $3
    </div>

</body>
</html>
]]>
</content>
    <tabTrigger>page</tabTrigger>
    <scope>source.html</scope>
    <description>HTML5 Base HTML</description>
</snippet>
like image 341
mtpultz Avatar asked Sep 15 '13 02:09

mtpultz


People also ask

How do I get snippets in Sublime Text?

To create a new snippet, select Tools | New Snippet…. Sublime Text will present you with an skeleton for a new snippet. Snippets can be stored under any package's folder, but to keep it simple while you're learning, you can save them to your Packages/User folder.

How do I edit a sublime-snippet?

Select Package Resource Viewer: Open Resource, navigate down the list to LaTeX, then open the section-.. -(section). sublime-snippet file. You should now be able to edit this file and save it, which will create a new file Packages/LaTeX/section-..


2 Answers

You should use text.html instead of source.html in scope block.

like image 177
awesoon Avatar answered Oct 21 '22 16:10

awesoon


Sublime 3 needs snippets to have .sublime-snippet endings in file name.

like image 34
Kristian Avatar answered Oct 21 '22 16:10

Kristian