Notepad++ premade snippets
Asked Answered
D

7

14

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.

Danialdaniala answered 1/5, 2010 at 11:35 Comment(2)
videos like this? (TextMate for Mac) youtube.com/watch?v=jqj1t4qFFwMMaya
Yep, i found QuickText, but it doesn't work anymore. Could someone using n++ recommend another plugin?Danialdaniala
H
23

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>
Hamblin answered 6/7, 2010 at 17:33 Comment(2)
As mentioned in docs.emmet.io: "Emmet (previously known as Zen Coding) is a web-developer’s toolkit that can greatly improve your HTML & CSS workflow."Aruwimi
Thanks for this tip! In 2020, Zen Coding tip you mentioned works like a charm in NPP 7.8.7! I actually see Zen Coding plugin now and Emmet seems to have disappeared!Chappelka
I
15

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>
Indicative answered 15/5, 2013 at 6:57 Comment(0)
S
6

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.
Stegall answered 24/6, 2019 at 19:14 Comment(0)
T
3

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.

Toot answered 14/11, 2013 at 21:43 Comment(0)
E
1

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.

Ephesian answered 2/8, 2012 at 21:32 Comment(1)
It's not appropriate to link to your blog as "contact information" in a post. I am editing that out of your post; do not do it in the future, or you may be deleted as 'spam'.Septuagint
S
1

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.

Sapheaded answered 21/1, 2019 at 18:53 Comment(0)
F
-6

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.

Fishbolt answered 4/5, 2011 at 20:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.