7

我正在尝试了解如何将自定义片段添加到 Notepad++ 的 Zen Coding (ZC) 插件。我找到了 ZC 存储其片段的文件

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

但我有一些问题:

  1. “snippets” 和 “abbreviations” 和有什么不一样?
  2. ZC 在不同的上下文中以不同的方式扩展键入的缩写。例如Z,后跟Ctrl+E有时扩展为z-index:|;,有时扩展为<z></z>。ZC 如何识别上下文?
4

3 回答 3

2

实际上,Zen Coding 现在更名为Emmet , Notepad++也可以使用它,并且它有一些关于自定义的文档

看来您需要阅读它的snippets.json格式。

我看不出那里的片段和缩写之间的区别,所以最好尝试两种方式。

Zen Coding(和Emmet)基于编辑器识别上下文,例如在ST2中它基于当前的语法和范围,我认为应该有类似于Notepad ++的东西

于 2012-11-28T12:44:16.170 回答
0

这是一个缩写的例子:

ul.myClass0$>li*5>a

这是一个片段的示例:

<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>
于 2014-10-18T22:25:00.447 回答
-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.

于 2011-05-12T20:14:10.220 回答