Sublime Forum

Zen Coding ( CSS Snippets )

#205

I really appreciate U adapting Zen Coding (ZC) for UE.

I was wondering if U had tried it with CSS snippets which ZC has …e.g.

bdcl:c … hot key inserts border-collapse:collapse;

I changed function getEditorType (around line 1290) to return ‘css’ & tried some css snippets and it seems to work fine as long as the abbr snippet doesn’t have a ‘:’ like the example above … here the entry point isn’t correct and a pattern of deleting line 1 , col 1 char, but bdcl hot key … abbr snippet without : …doesn’t suffer from same problem.

Wondered if U had tried it or had plans to w/ css… regardless if you do or don’t a much appreciated contribution.

Update… altered how the replacement text was inserted and now it handles css abbr with/without the colon : whereas before the colon was a problem. Still the heavy lifting was down by Echopark.

0 Likes

#206

ZenCoding is now available via Package Control. wbond.net/sublime_packages/package_control

0 Likes

#207

I have had much frustration with this so called Zen Coding over the past few days.
Basically “tab” refuses to expand any abbreviation that I type and there is no CSS or html hints. (and yes I have saved the file as .html first)
Installed it with package control found at wbond.net/sublime_packages/package_control
But I’ve also tried downloading various versions of it and putting them in the packages folder myself to no avail.
Could someone please help me, I’m starting to give up hope for sublime text and may be forced to go back to Dreamweaver if I can’t get Zen to work.

Is there some sort of secret setting that I’m missing that only people in the know, know of. I’ve tried looking through zen-coding.sublime-settings & a few other files in the Zen Coding folder but I can’t see any key bindings settings or anything that looks like it will fix it.

0 Likes

#208

@ cameronelkin,

Have you used any Zen Coding before? While this plugin can do a lot of things, it’s main focus is adding Zen Coding (code.google.com/p/zen-coding/) to ST2. For example, if you type: html>head+body>div#nav>ul>li*3>a+div#content>h1+p, and then press either TAB or Ctrl+Space, zencoding expands the text to: [code]



























[/code]
0 Likes

#209

[quote=“cameronelkin”]I have had much frustration with this so called Zen Coding over the past few days.
Basically “tab” refuses to expand any abbreviation that I type and there is no CSS or html hints. (and yes I have saved the file as .html first)
Installed it with package control found at wbond.net/sublime_packages/package_control
But I’ve also tried downloading various versions of it and putting them in the packages folder myself to no avail.
Could someone please help me, I’m starting to give up hope for sublime text and may be forced to go back to Dreamweaver if I can’t get Zen to work.

Is there some sort of secret setting that I’m missing that only people in the know, know of. I’ve tried looking through zen-coding.sublime-settings & a few other files in the Zen Coding folder but I can’t see any key bindings settings or anything that looks like it will fix it.[/quote]

It wasn’t working for me too since i installed the “new” version yesterday. After deleting all the .pyc files from the ZenCoding Package plus this one: Packages/User/my_zen_settings.pyc and after disabling most of the other plugins i have installed it is working now. It is still working with the other plugins enabled again, so i am not sure where the problem was.

You can also try resetting the application (http://www.sublimetext.com/docs/2/revert.html) and installing package control and zen coding and restarting the application. Just to see if it is working.

0 Likes

#210

Fixed it with a full re-install of sublime 2 and ZenCoding, abbreviations now expand.

0 Likes

#211

I have just installed ZenCoding package through Package Control but it fails to work. The following is output in the console:

Reloading plugin /Users/kev/Library/Application Support/Sublime Text 2/Packages/ZenCoding/sublimezen.py
Traceback (most recent call last):
  File "./sublime_plugin.py", line 57, in reload_plugin
  File "./sublimezen.py", line 25, in <module>
    import zencoding
  File "./zencoding/__init__.py", line 1, in <module>
    import utils
ImportError: No module named utils
Reloading plugin /Users/kev/Library/Application Support/Sublime Text 2/Packages/ZenCoding/sublimezenplugin.py
Traceback (most recent call last):
  File "./sublime_plugin.py", line 57, in reload_plugin
  File "./sublimezenplugin.py", line 12, in <module>
    from zencoding.parser.abbreviation import ZenInvalidAbbreviation
  File "./zencoding/__init__.py", line 1, in <module>
    import utils
ImportError: No module named utils

Any ideas on how to get this working?

Thanks.

0 Likes

#212

I THINK I KNOW WHY ZEN CODING STOPS ABBREVIATING.

i tried using zen coding which i installed via package control with html5 which I also installed from package control. it doesn’t expand abbreviations
but under plain html it does.
when i switch to html5 it doesn’t!

ok now it won’t work anywhere… once i install html5 it stops working altogether.
CONFIRMED! i disabled html5 package and it started working again

0 Likes

#213

Hi,

I wrote a month ago about problem with ZC in css files. Can somebody confirm that this is just my issue or it’s problem with plugin?

Thanks

Examples:
CTRL + SPACE when Zen is enabled.
http://img502.imageshack.us/img502/6470/sublime.jpg

CTRL + SPACE when Zen is disabled.
http://img26.imageshack.us/img26/9844/sublimewithoutzen.jpg

0 Likes

#214

Did a quick test. With Zen enabled the coursinfo reference works.

0 Likes

#215

Did some test again i think i found when bad behavior occur. If is new line on end of the file everything works ok. If somewhere inside of the file it doesn’t work.



0 Likes

#216

you are right! I have the same behaviour, seems to be a bug. Quite interesting that no one found this annoying before :wink:

0 Likes

#217

Maybe I write too much css :smiley: Hope somebody will fix this.

0 Likes

#218

i have an issue why bitbucket doesnt let me load the repository thanks in advance

0 Likes

#219

The package is no longer on Bitbucket. To install, you’ll have to use Package Control (http://wbond.net/sublime_packages/package_control)

0 Likes

#220

I’ve installed Package Control. Please could someone tell me how to install Zen Coding using it?

Thanks

0 Likes

#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