Sublime Forum

Zen Coding ( CSS Snippets )

#221

bring up the command palette by going to tools > command palette (or by using the keyboard shortcut) and type Package Control. A list of options will appear. One of them is “Install Package” Press it. A list of all the available packages will now appear. Either type “zencoding” or scroll all the way down until you find it. Press enter. On the status bar at the bottom, it should say “Instaling zencoding.” It should only take a couple seconds and then will say, “Installation complete.” You’re done.

0 Likes

#222

Hi Guys,

I’ve been trialling Sublime Text 2 and have an issue with Zen Coding which is really annoying –

Typing a hash ‘#’ or period ‘.’ anywhere in an HTML document then hitting TAB expands to <div id=""></div> and <div class=""></div> respectively.

This is especially annoying when putting in anchor links i.e. if I create a list of links

ul>li*3>a

and expand it

<ul>
	<li><a href=""></a></li>
	<li><a href=""></a></li>
	<li><a href=""></a></li>
</ul>

then type ‘#’ in the first href="" and hit tab to move to enter the link’s text I end up with:

<ul>
	<li><a href="<div id=""></div>"></a></li>
	<li><a href=""></a></li>
	<li><a href=""></a></li>
</ul>

With logging enabled all the console shows is "command: insert_best_completion {“default”: " “, “exact”: false}”

Can anyone offer some insight into this please??

0 Likes

#223
  {
      "keys"    : "tab"],
      "__doc__" : "Insert a completion when there is a snippet active as long as there's a valid abbrevation that doesn't end in a full stop.",
      "command" : "insert_best_completion",
      "args"    : {"exact" : false, "default": "\t"},
      "context": 
          { "key": "is_zen",                 "operator": "equal",              "operand": true },
          { "key": "preceding_text",         "operator": "not_regex_contains", "operand": "\\.$",      "match_all": true },
          { "key": "has_next_field",         "operator": "equal",              "operand": true },
          { "key": "setting.tab_completion", "operator": "equal",              "operand": true },
          { "key": "selector",               "operator": "equal",              "operand": "text.html", "match_all": true}
      ]
    }

You’ll need to tweak this binding. I imagine it would be the cause of your frustration.

Specifically the context { "key": "selector", "operator": "equal", "operand": "text.html", "match_all": true}

More specifically again the selector text.html which is far too vague.

The binding was an experiment that seems to have survived like some weed.

It should probably be eliminated completely …

0 Likes

#224

It seems that i am dummie, but how to expand string? In ctrl-alt-enter we have new text field to enter zen-code, but i want to expand string typed in editor (like ctrl-e on another text-editors with zen-coding plugin).
Default linux keymap file is so large, and i cant find expanding there. Anyway, ctrl-e is binded by sublime text 2 by default.
How to bring by my old-good CTRL-E?

0 Likes

#225

Try it with TAB

0 Likes

#226

Thanks a lot, it works!

0 Likes

#227

Is there a listing of which Zen coding shortcuts work?

For example, one that I used frequently with TextMate and Espresso was new documents, “html:5” and “html:xt”

Neither of these seem to work.

0 Likes

#228

[quote=“castles_made_of_sand”] { "keys" : "tab"], "__doc__" : "Insert a completion when there is a snippet active as long as there's a valid abbrevation that doesn't end in a full stop.", "command" : "insert_best_completion", "args" : {"exact" : false, "default": "\t"}, "context": { "key": "is_zen", "operator": "equal", "operand": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "\\.$", "match_all": true }, { "key": "has_next_field", "operator": "equal", "operand": true }, { "key": "setting.tab_completion", "operator": "equal", "operand": true }, { "key": "selector", "operator": "equal", "operand": "text.html", "match_all": true} ] }

You’ll need to tweak this binding. I imagine it would be the cause of your frustration.

Specifically the context { "key": "selector", "operator": "equal", "operand": "text.html", "match_all": true}

More specifically again the selector text.html which is far too vague.

The binding was an experiment that seems to have survived like some weed.

It should probably be eliminated completely …[/quote]

OK, how do I “tweak” this to prevent the behavior described by @swwd? I tried commenting this entire section out of Default (OSX).sublime-keymap but I still get the problems described: hitting tab after # gets you <div id #> etc.

I’d be happy if the completion only happened on command-space.

0 Likes

#229

I’d like to change this to a different keymap as well (super+alt+e). Not quite sure how to go about doing this as altering the Max OSX default mapping doesn’t seem to change anything.

0 Likes

#230

I have keybindings in Packages/User/Default (OSX).sublime-keymap and they are used.

0 Likes

#231

There is no zencoding in that list…is there another waz to instal it ?

http://ist1-4.filesor.com/pimpandhost.com/4/6/9/7/46974/S/4/d/a/S4da/no-zenCoding.jpg

0 Likes

#232

[quote=“radojica”]There is no zencoding in that list…is there another waz to instal it ?

http://ist1-4.filesor.com/pimpandhost.com/4/6/9/7/46974/S/4/d/a/S4da/no-zenCoding.jpg[/quote]

BitBucket was down for a few hours this morning, thus all packages from there were not available. It appears to be back online now, so you should be able to try again.

0 Likes

#233

[quote=“wbond”]
BitBucket was down for a few hours this morning, thus all packages from there were not available. It appears to be back online now, so you should be able to try again.[/quote]

Still isn’t at the list :frowning:

0 Likes

#234

[quote=“radojica”]
Still isn’t at the list :frowning:[/quote]

Not trying to be rude, since this has happened to me in the past, could you check your sublime packages folder (Preferences > Browse Packages) to check to see if you already have ZenCoding installed? Because if you have it installed, it will not appear in the last.

0 Likes

#235

Stops working in 2160.

0 Likes

#236

Anyone know how to get this working with stylus files? .styl

Its similar to SCSS, but a whitespace based language.

Basically I’m looking for the properties to evaluate. I can’t seem to figure out where to add the Stylus filetype. If i switch it to css it works well.

Best,
Bob

0 Likes

#237

Hi, I am unable to get zencoding to work using Tab. I read everything in this thread, I reinstalled it twice but to no avail.

Using latest version 2610.

0 Likes

#238

[quote=“Trebby”]Hi, I am unable to get zencoding to work using Tab. I read everything in this thread, I reinstalled it twice but to no avail.

Using latest version 2610.[/quote]

try using a “>” after your abbreviation

this:

html:5>div#page>(div#header>ul#nav>li*4>a)+(div#page>(h1>span)+p*2)+div#footer

will become:

html:5>div#page>(div#header>ul#nav>li*4>a)+(div#page>(h1>span)+p*2)+div#footer>

it’s just a workaround though. I hope it will get a fix.

0 Likes

#239

It works! Thanks a lot for the quick response!

0 Likes

#240

Unfortunately ZenCoding currently has no maintainer. I host a copy of it on my bitbucket account so people can continue to install it, however I don’t personally use it, and don’t have time to maintain it in addition to my other plugins.

0 Likes