7

I'm trying to get how to add custom snippets to Zen Coding (ZC) plugin for Notepad++. I found the file where ZC stores its snippets

C:\Program Files\Notepad++\plugins\NppScripting\includes\Zen Coding.js

But I have some questions:

  1. What the difference between “snippets” and “abbreviations” ?
  2. ZC expands typed abbreviations differently in different contexts. For example Z followed by Ctrl+E sometimes expands as z-index:|; and sometimes as <z></z>. How does ZC recognize the context?

3 Answers 3

2

Actually, Zen Coding is now renamed as Emmet, which is also available to Notepad++ and it have some docs on customization.

It seems that you need to read on it's snippets.json format.

I can't see the difference between the snippets and abbreviations there, so it would be best to try both ways.

Zen Coding (and Emmet) recognize context based on the editors, for example in ST2 it is based on the current Syntax and Scope, I think there should be something similar to Notepad++

0

This is an example of an abbreviation:

ul.myClass0$>li*5>a

This is an example of a snippet:

<ul class="myClass01">
    <li><a href=""></a></li>
    <li><a href=""></a></li>
    <li><a href=""></a></li>
    <li><a href=""></a></li>
    <li><a href=""></a></li>
</ul>
-4

I have not worked with Zen Coding but I prefer to run a macro to store most of my snippets. I find them easy and customizable and you can set whatever shortcut key combo you would prefer.
If you go to Macro > "Start Recording" and then enter in whatever snippet you would like then press "Stop Recording" and then "Save Current Recorded Macro" it will prompt you for what shortcut key you would like. There might be a more elegant way to accomplish this, but I find quick and easy is always good.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.