When I create a new file on npp its just a blank document, can I make it generate an html doctype strict/transitional like how dreamweaver does with the premade t开发者_Python百科emplates?
You can achieve this by using macros:
- Press Start Recording button on Notepad++ toolbar:
- Open a new document
- On the newly opened tab, TYPE your template code (type code, don't paste it)
(e.g.:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
) - Press Stop Recording button:
- Save your just recorded macro:
assign a keyboard shortcut if you want:
- Run macro from menu or invoke it by keyboard shortcut you assigned on save, whenever you want to create a new template-based document:
Also you can open as many template-based documents as you want, by selecting option Run a Macro Multiple Times from Macro menu:
That's it. I hope this info will be helpful for you.
There is also a simple plugin called "NewFileBrowser" which you can find using Plugins>Plugin Manager. It will set up two templates for you that you can use for your boilerplates. Actually the default value it comes with are an html 4.01 template and a java class.
Configuring it is quite easy to figure out. Once installed it gives you a menu item under Plugins>NewFile&Browser>Create New File which will open a new document with your boilerplate contents in it.
It's perfect if, like me, you only need it for new html documents.
精彩评论