Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ premade template

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.

like image 778
bah Avatar asked May 01 '10 11:05

bah


3 Answers

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>
like image 170
gpmcadam Avatar answered Oct 17 '22 15:10

gpmcadam


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.
like image 45
Thyag Avatar answered Oct 17 '22 16:10

Thyag


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>
like image 13
hkarask Avatar answered Oct 17 '22 14:10

hkarask