记事本++预制片段

发布于 2024-08-30 14:43:08 字数 86 浏览 11 评论 0原文

我在视频中看到,人们通过输入“html:5”或类似的内容来获取 html 模板(顺便说一句,他们没有使用 notepad++)。这在记事本++中可以吗?谢谢。

I have seen in videos, that people get html template by typing "html:5" or something like that (btw, they're not using notepad++). Is this possible in notepad++? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

赠我空喜 2024-09-06 14:43:08

有点晚了,但你正在寻找的是禅宗编码。

Google 托管的 Zen Coding 项目有一个 NotePad++ 插件 这应该完全符合您的需要。

例如,输入如下内容:

html>head+body>div#content>ul.nav>li*5

后跟 Ctrl + E,展开为:

<html>
    <head></head>
    <body>
        <div id="content">
            <ul class="nav">
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
    </body>
</html>

A little late, but what you're looking for is called Zen Coding.

The Zen Coding project hosted on Google has a plugin for NotePad++ that should do exactly what you need.

For example, entering something like:

html>head+body>div#content>ul.nav>li*5

Followed by Ctrl + E, expands into:

<html>
    <head></head>
    <body>
        <div id="content">
            <ul class="nav">
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
    </body>
</html>
戏舞 2024-09-06 14:43:08

现在它在 Notepad++ 中称为 Emmet 插件,

只需输入 html:5 并按 control + alt + Enter
您将得到以下标记:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

</body>
</html>

Now it's called Emmet plugin in Notepad++

Just type html:5 and press control + alt + enter
and you will get the following markup:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

</body>
</html>
剪不断理还乱 2024-09-06 14:43:08

选项 1

安装并使用 Notepad++ Snippets 插件。

  • 您可以输入所需的任何代码片段并为每个片段命名。
  • 当您双击片段名称时,片段文本只会复制到您的编辑器(在光标之前或之后,具体取决于您的设置方式)
    输入图像描述这里

选项 2

如果您没有管理员访问权限或位于防火墙后面,则存在宏黑客攻击。
如果您的模板有点短,那么您可以使用内置的并手动键入模板文本(每个模板一次性操作)。然后,您可以“保存当前录制的宏”并为您创建的每个新文件重播它。 Emmet 仅适用于 html,但此技术适用于任何类型的文本(只要您可以手动键入文本)

注意:您无法在录制时复制粘贴(Ctrl-C/Ctrl-V)文本。复制粘贴当前剪贴板的内容,这是不可取的!

对于那些喜欢分步说明的人:

  • 打开 Notepad++。选择宏->开始录音。
  • 键入您的文本(现在正在记录每次击键,因此请尽量减少退格和删除)
  • 单击:宏 ->停止录制
  • 单击:保存当前录制的宏并为其命名(例如“bash_header”或“html_struct”)
  • 现在单击您的宏名称以将模板文本重复应用到您的 notepad++ 文件。

Option 1

Install and use the Notepad++ Snippets plugin.

  • You can input whatever code snippet you want and give each snippet a name.
  • When you double-click on your snippet name, the snippet text just gets copied to your editor (before or after your cursor, based on how you set it)
    enter image description here

Option 2

If you don't have admin access or behind a firewall, there is a Macro hack.
If your template is a bit short, then you can use the built-in MACRO and manually key in the template text (a one-time operation per template). You can then "Save Current Recorded Macro" and replay it for every new file that you create. Emmet works only for html, but this technique works for any kind of text(as long as you can manually key-in the text)

Note: You cannot copy-paste (Ctrl-C/Ctrl-V) text while recording as it will copy-paste current clipboard's contents which is undesirable!

For those who like step-by-step instructions:

  • Open Notepad++. Select Macro -> Start Recording.
  • Key-in your text (every key-stroke is now being recorded, so minimize backspaces and deletes)
  • Click : Macro -> Stop Recording
  • Click : Save Current Recorded Macro and give it a name (say "bash_header" or "html_structure")
  • Now click on your Macro name to repeatedly apply the template text to your notepad++ file.
零度℉ 2024-09-06 14:43:08

使用 NP++v6.1.4,我可以很快地完成此操作:

  • 选择插件 ->插件管理器->显示插件管理器
  • 等待所有插件显示,然后选中 Emmet 复选框
  • 它可能会提醒您 Python 也将被安装
  • 一旦完成安装,允许 NP++ 重新启动,现在您就可以使用许多 Emmet 功能了:)

现在,只需输入!并按 ctrl-alt-enter。

Using NP++v6.1.4, I got this to work pretty quickly doing this:

  • Choose Plugins -> Plugin manager -> Show plugin manager
  • Wait for all the plugins to be shown, and check the box Emmet
  • It may alert you that Python will also be installed
  • Once it completes its installation, allow NP++ to be restarted, and now you can use the many Emmet features :)

Now, just type ! and hit ctrl-alt-enter.

红玫瑰 2024-09-06 14:43:08

您可以使用 QuickText 创建您自己的模板。似乎不再支持 QuickText,但它仍然有效,只是文档中有一些错误的内容。

You can use QuickText to create your own templates. It seems that QuickText isn't supported anymore, but it still works, the documentation just has some wrong content.

愛上了 2024-09-06 14:43:08

我使用一个名为 Ditto 的程序,它就像所有复制粘贴材料的剪贴板。我把预先写好的语法固定在那里。它有帮助。

I use a program called Ditto, it's like a clipboard of all your copy-paste material. I have my prewritten syntax in there pinned. It helps.

橘味果▽酱 2024-09-06 14:43:08

实际上,这称为标记代码。尽管“禅宗编码”正在取代标记而变得众所周知,但它是为代码构建结构的原始术语;这使得其他人更容易阅读。

就 Notepad++ 的模板而言,恐怕很难找到公共的、定制的模板。尽管该程序确实附带了定制模板(例如 Hello Kitty 模板),但您最好的选择是询问在线编程社区中的人员。

我个人最喜欢的是 DreamInCode,他们提供帮助和支持,以及有关许多不同计算机编程的信息丰富的教程和网络开发语言。我相信,如果您找不到您喜欢的内容(如果有的话),有人会很乐意为您提供帮助。

In actuality, it is called marking up your code. Although "zen coding" is becoming well known in place of markup, it is the original term for building a structure for your code; which makes it easier for others to read.

As far as the template thing goes for Notepad++, I'm afraid that it is difficult to find public, custom made templates. Although the program does come with custom made templates, such as the Hello Kitty template, your best bet would be to ask people in online programming communities.

My personal favorite is DreamInCode, where they offer help and support, as well as pretty informative tutorials on numerous different computer programming and web development languages. I'm confident that if you can't find one you like that has been posted there, if any, someone would be glad to help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文