Having said that one limitation with NPP is that it does not insert closing tags automatically. You have to type the <, >, /> every thing by yourself. Whatever advantages HTML and XML have, no one said it is keyboard friendly.
When I have to create some HTML, I found this is a big inconvenience. I quickly searched for a work around. I found macros are supported in NPP. The macros in NPP is much simple (and less sophisticated) than that in Office and Windows. It simply allows you to record key presses and you can play it back on demand.
Here is the steps to create an HTML tag wrapper macro in NPP.
- Open Notepad++ (I use version 5.4.3)
- Type some html tag, say html (without < and >) and double click on it to select it.
- Now click on Macro menu, and click on Start Recording.
- Press these keys. CTRL+C, LEFT ARROW, <, CTRL+RIGHT ARROW, >, <, /, CTRL+V, >, LEFT ARROW, CTRL+LEFT ARROW, LEFT ARROW.
- Click on Macro menu, and on Stop Recording.
- Now test this. Move to a new line and type in another html tag. for e.g. body. Now select it, and click on Macro, Play Back.See the <, > and closing tags are inserted.
- Save this macro by clicking on Save current recorded macro in Macro menu.Give a name to it, some thing like TagWrapper. Click OK. From experience I learned that the keyboard shortcut that you can add here starts recording only. So, don't bother about it time being.
- Now you can see the TagWrapper is added to the macro menu. See screen shot below.
- Next time when you want to insert an html tag, do like this. Type in the tag name, like table, select it, and then click on Macro menu, and select TagWrapper.
By the way, if you want to edit HTML in NPP, first select the language as HTML. To do this, click on Language menu and select HTML.
Also, this macro clears the clipboard. See the Ctrl+C and Ctrl+V keys in the step 4.
Hope this helps some one.