Sublime Forum

Zen Coding ( CSS Snippets )

#141

Yes. I’ll try tomorrow

0 Likes

#142

It’s almost certainly an issue with Subilme Text 2 itself

0 Likes

#143

A bug has come to light in Zen for me. I think I’m using the most up-to-date version of Zen, and I’m on b2098 of ST2. I think the bug’s been around as long as I’ve known Zen on ST2. Anyway on to the bug:

The main bug here is that in PHP, if I place the caret in the middle of some PHP and hit the alt+shift+w command, any variable references (e.g., ‘$variable’) inside the PHP disappear. My assumption is that it has something to do with the dollar sign followed by word characters means something special which is somehow being clobbered by Zen.

So say you had this HTML:

<span><?php echo 'hi'; ?></span>
<span><?php echo $variable; ?></span>
<span><?php echo $object->property; ?></span>

After wrapping each line individually (for simplicity) you end up with:

<span><a href=""><?php echo 'hi'; ?></a></span>
<span><a href=""><?php echo ; ?></a></span>
<span><a href=""><?php echo ->property; ?></a></span>

Another thing I’m experiencing which may or may not be a bug is that if these PHP snippets weren’t individually wrapped in HTML tags (in this case span but it can be anything in my testing) it treats the three lines of PHP as a single block and therefore will wrap the ‘a’ (in this case) around the three lines as a whole rather than each line getting its own ‘a’. Now, I have a feeling this may be how the plugin is supposed to work, as it will never be able to predict whether an HTML author means a list or a non-breaking paragraph (the normal HTML whitespace rules) by multiple lines with no separating tags. Having said that, I think that for the most part, the preferred behaviour would be broken lines. I know this can be done by selecting multiple lines, pressing c+s+l to split lines, and then Zenning, but I think that default behaviour for Zen really could be straight select then Zen treats the lines as separate entities. I bet that >90% of the time people do that they mean it as if the lines are separate. But feel free to correct me, other developers.

0 Likes

#144

Excellent. Thanks for this. I obviously need to brush up on my Zen, this does exactly what I wanted.

0 Likes

#145

Hi Sublimator,

A few pages back someone posted that they are having an issue using zen with twig bundles. I’m seeing the same bug related to typing a dot within my twig braces (typing a dot causes class=" " to appear.)
You asked for some debug information and I’m not sure if you got it, if you need help looking into this issue then I’ll do what I can.

viewtopic.php?f=2&t=580&start=240#p10958

Anyway you asked for the expression scope - I ran the shortcut you gave - this is what I got (in the info bar in the bottom of my screen)

column 48; punctuation.section.tag.twig meta.tag.template.value.twig text.html.twig

-Cheers

0 Likes

#146

Thanks! For anyone else how is tracking this - this fix is here.
bitbucket.org/sublimator/sublim … 74b64819d4

0 Likes

#147

I’m having trouble with css completions.

When I’m in a CSS file (scope: source.css), completion of some css properties doesn’t work. For instance ‘pos’ becomes ‘progress’ instead of ‘position: ;’. However, most of the mnemonics that have a colon (like ‘pos:s’) work as advertised.

I’m using ST2 Build 2109 and the latest ZenCoding bundle installed via Package Control.

0 Likes

#148

@Sublimator: can this be done in… reverse? I kind of need to remove the zen completion and keep only mine… :smiley:
I only need „zen as you type” feature. Css completion are not my type, to say so.
eg:
re => resize (instead of relative, which is much useful for me)
c => color:#000;| (instead of color:#|[000]:wink:
those are first i found in like 30 seconds.

On the other hand, zen as you type is pure awesomeness that i can’t use because of the css thing :frowning:

Please make a way of disabling parts of the plugin :smiley:

0 Likes

#149

Yeah, I’m using a completion file (it’s come handy to have one file with ~200 lines rather than 200 files :smiley: )

Btw, there is a way of keeping completion only from the completion file, not from the existing file too? There are some weird situation when I really don’t need that. (this is not related to zen in any way though)

My hero! :mrgreen:

0 Likes

#150

Thanks. But… still doesn’t work right.
screencast.com/t/RPmUQu1wKts

0 Likes

#151

The setting is in User/zen-coding.sublime-settings.

Anyhow!
I removed this:

            (CSS,  ( (CSS_SELECTOR,              self.css_selectors),
                     (CSS_VALUE,                 self.css_property_values) )),

From the sublimezenplugin.py and seems to works fine. I mean works exactly like I wanted to work!
(searched for disable_completions in py files and started to remove various things)

So… Thanks! I finally can use this awesome plugin!

/// edit:
After i took a look into default keymap file (on win) i discovered this: without zen, when i’m typing : i automatically get :neutral_face:;. With zen i only get : (i think you should keep the original behavior and only remove it if there is a completion or smth)

0 Likes

#152

Yeah, i get that too, but doesn’t work like it should (and like it works without the lines i mentioned above).
Anyhow, now i’m extremely happy with what i have, so I guess is enough. I hope i won’t forget what i changed on the next update :mrgreen:

Btw, do you have a paypal account? :smiling_imp:

0 Likes

#153

I tried searching but couldn’t find a way to override the keyboard mappings in ZenCoding\Default (Windows).sublime-keymap without editing this file.
Is this possible?

Also, does anyone have any idea why I can’t enter the “@” character anywhere ST2? I’m have a QWERTZ type keyboard, so the keystroke would be AltGr+V. Some keyboard mapping might be overriding it, but how do I find out which one?

0 Likes

#154

[quote=“sublimator”]Bindings can be a bit of PITA with Sublime

You can put bindings in the User/Default*.sublime-keymap

Why do you need to edit it? Conflicts with other packages? Or just don’t like the default bindings?[/quote]

I’m having trouble with the Zen command bound to crtl+alt+n because it’s equal to altgr+n on my keyboard. And I need to be able to press altgr+n because that’s how I enter the right curly bracket ‘}’. But if I change ctrl+alt+n in ZenCoding, it won’t survive upgrading like you said.

Unfortunately, that command logs everything except altgr+v which is the “@” character :frowning:

0 Likes

#155

Hello, I’m having an issue. I use encoded images (data-uri images) in my css and I have string with something like that ‘fZHTuLCd4eMG7DV4buzZ7mQBpb569Fn883w1o4JlMLYrQ1C2mjJmv2U’, now ‘fz’ don’t turn into ‘font-size:;’ - in turn into first example.

Here are steps to reproduce:
Open new tab, set css syntax;
Use following sample:
{
fz
}
{
fZHTuLCd4eMG7DV4buzZ7mQBpb569Fn883w1o4JlMLYrQ1C2mjJmv2U
}

Click tab after fz - it will turn into ‘fZHTuLCd4eMG7DV4buzZ7mQBpb569Fn883w1o4JlMLYrQ1C2mjJmv2U’

I use v2111. If it don’t turn for you - try to play with css a little, then try again.

Any way to fix this? Thank you for zen coding on sublime!

0 Likes

#156

[quote=“sublimator”]What other ctrl+alt+ bindings are off limits for alt_gr folks?

I made a context for ctrl+alt+n anyway: {“operand”: false, “operator”: “equal”, “key”: “setting.alt_gr”}

If you set "alt_gr": true in your User\Base File.sublime-settings it should be picked up.
[/quote]

Thank you. That fixed the “ctrl+alt+n” problem. However, I still can’t enter the “@” character anywhere in ST2. Not even in the find/replace dialog.

0 Likes

#157

Look like commit 0a7ad5343b75 enable debug by default, which run log_commands(True).
By the way, thanks sublimator for your commitment to this wonderful plugin.

0 Likes

#158

Thanks, that did the trick.

0 Likes

#159

@sublimator, in your screencast in the first page… how did you end up with a multiline selection to start writing inside all the

  • tags right after you wrote the “*5” in the zen code?
  • 0 Likes

    #160

    I really enjoy ZenCoding in other editors, but I don’t quite understand the following behavior:

    * { m! }
    When I hit [TAB] now, it’s working as expected and expands into this:

    * { margin:!; }
    I then go on and add other styles. But when I have something like this:

    * {
       margin:0;
    }
    
    body {
      m!
    }

    and now hit [TAB] I get the following:

    * {
       margin:0;
    }
    
    body {
      margin!
    }

    Completions like m:a do always work, but m:2 to m:4 don’t work using the TAB-Trigger. What puzzles me the most is that when I enable the debug mode the console tells me the right completion:

    * { m:4! }

    When I hit [TAB] it prints this into the console but no completion:

    ZenCoding: on_query_completions expand_abbr abbr: u'm:4' result: u'margin:0 0 0 0;'[/code]
    
    I have found that when you put a dot (.) or a hash-mark (#) the expansions always work:
    [code]* {
      m:4#!
      padding:0;
    }
    
    body {
      p.!
    }

    Successfully expands to:

    [code]* {
    margin:0 0 0 0;!
    padding:0;
    }

    body {
    padding:!;
    }
    [/code]

    0 Likes