Home Download Buy Blog Forum Support

Snippets, zen coding

Snippets, zen coding

Postby Sh4d0W on Tue Nov 15, 2011 9:05 pm

Hello all sublimers :),
Im new here and first I want to say that i love Sublime Text, i was using notepad++ and i still miss some of the features but i hope they will be implemented later.

So here is what i want to do:
I want to create a snippet to insert HTML5 doctype, meta tags etc.
Here is the code of the snippet:

Code: Select all
<snippet>
   <content><![CDATA[<!DOCTYPE html>

<html lang="en">
<head>

   <meta charset="utf-8" />
   <meta name="author" content="" />
   <meta name="description" content="" />

   <title>$1</title>

   <!-- Include CSS -->
   <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
   <link rel="stylesheet" href="css/style.css" />

   <!-- Include jQuery -->
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>

   <!-- Include functions -->
   <script src="js/functions.js"></script>

</head>]]></content>
   <tabTrigger>html5</tabTrigger>
   <description><!doctype html></description>
</snippet>


But when i try to save it, i get this error:

Code: Select all
No content for snippet Packages/HTML5/DoctypeHTML.sublime-snippet


And when i try to trigger the snippet, it just doesnt do anything.

---------------------------
And actually i just noticed that when i use zen coding, and for example i want to do something like ul>li and i press tab,
this is what i get:
Code: Select all
ul><li><a href="" title=""></a></li>
   li

instead of just
Code: Select all
<ul><li></li></ul>

Is there any way to fix this? Because it seems like there is something wrong with zen coding.

I hope its not too much,
Thanks in advance :)
Sh4d0W
 
Posts: 21
Joined: Mon Nov 14, 2011 6:06 pm

Re: Snippets, zen coding

Postby gjd on Wed Nov 16, 2011 6:21 pm

Sh4d0W wrote:And actually i just noticed that when i use zen coding, and for example i want to do something like ul>li and i press tab,
this is what i get:
Code: Select all
ul><li><a href="" title=""></a></li>
   li

instead of just
Code: Select all
<ul><li></li></ul>

Is there any way to fix this? Because it seems like there is something wrong with zen coding.

I hope its not too much,
Thanks in advance :)


This works correctly for me, although I have to hit Enter after "ul>li" rather than tab. Just to be clear, are you entering the Zen Coding string after launching the input panel by ctrl+alt+enter? I'm using ST2 2143 on OS X, not sure which version of Zen Coding.
gjd
 
Posts: 8
Joined: Sat Oct 22, 2011 11:09 pm

Re: Snippets, zen coding

Postby Sh4d0W on Wed Nov 16, 2011 7:58 pm

Actually when i type it in the panel (ctrl+alt+enter) it works, tho when i type it in the document and then press tab to expand it messes up.
Well it looks like i will have to use this method instead, thanks :).

And btw do you know why the snippet thing doesnt work?
Sh4d0W
 
Posts: 21
Joined: Mon Nov 14, 2011 6:06 pm

Re: Snippets, zen coding

Postby Jim1 on Mon Nov 21, 2011 11:24 am

I'm trying to get how to add custom snippets to zen coding plugin (ZC) of my Notepadd++. I found the file where ZC stores its snippets - C:\Program Files\Notepad++\plugins\NppScripting\includes\Zen Coding.js but I have some questions:
What the difference between 'snippets' and 'abbreviations' ?
ZC expands typed abbreviations differently in different contexts. For examle z+ctrl+e sometimes expands as z-index:|; and sometimes as <z></z>... How does ZC recognize context ?
Beautiful Anchor Necklaces
10 Beautiful Rose Gold Earrings
Jim1
 
Posts: 3
Joined: Fri Nov 18, 2011 6:22 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 45 guests