In Dreamweaver typing </ will automatically close the last open tag, so you don't have to type it all out, and it helps if you aren't sure if you closed one or not. Is there a plugin that dose this for Notepad++?
This is not like text FX where typing the opening tag/bracket adds the close on the other side of the cursor. This behavior is an auto completion that happens when </ is typed, DW finds whatever the innermost open tag is, and closes it. I find that, when I have the option of using DW, I will use this feature far more often than anything else that DW provides. Thus I would love to know if there was a way to do it in NPP.
Here is DW preference in question:
Notice how there is a different option that does what text FX does, but I don't want that.
I am not opposed to unorthodox suggestions, some kind of macro, or hack of a plugging. Anything to emulate the functionality. If need be, I could write a plugin, I just have no idea how to go about it.
88 Answers
Go to TextFX / TextFX Settings and check "auto close XHTML tags".
This makes it work in plain HTML files as well.
3Yes, it's possible to do in Notepad++, and it's very easy to do. Follow these steps:
- Go to Settings.
- Click on the Preferences tab.
- Now click on Auto Completion. Here, you will see two sections: one is Auto Completion, and the other is Auto Insert.
- In the Auto Insert section, click on the check box which says HTML/XML Close Tags.
Very partial answer:
Do not enable in TextFX / TextFX Settings the option "Auto close XHTML/XML ".
Go to the Settings -> Preferences dialog box. Click in the Backup / Auto-completion tab and set the Enable auto-completion option.
This will only let you choose the ending tag name from its prefix.
Personally, I would prefer for Notepad++ the answer of @user79590 over my answer. If both answers are not satisfactory, then I would look for another HTML editor, since I don't believe any other possibility exists for Notepad++.
6Maybe you could use HTMLKit which has the shortcut 'ALT+END' which will end your current tag. Maybe N++ has something like that hidden...
2This thread may be pretty old, but here is the answer. Use the Plugin Manager (Plugins -> Plugin Manager) and install XML Tools.
Once installed, XML Tools will show up in the Plugins menu item and within its functionality is a "Tag auto close" option.
Cheers!
1If none of the answers above do what you want, you can also submit a feature request to the developer of Notepad++ here:
Or, you could develop the plug-in yourself and submit it to the developer.
try install :
Notepad Sharp plugin.
follow this step:
Click
Plugins>Notepad#>Close last open tagor press (
Ctrl+.)
Notes:
not really good for nested tag.
just good for your last open tag.
XML Tools plugin
follow this step:
- Click
Plugins>XML Tools>Tag auto-close
other question similar:
Notepad++ last open tag closing
Notepad++ XML Auto Indent + Tag Closing
HTML Tag Auto Complete in Notepad++?
Notepad++ - Highlight text and insert html <tag></tag> around it
Placing tags around selected text in notepad++
wrap selection around ... in notepad++
Using the Notepad++ Notepad# plugin mentioned in @user2427906's answer, and also AutoHotKey, it is possible to close HTML tags in your Notepad++ code after typing </, like in Dreamweaver. Once setup correctly, here is some AHK code you can use to get it to work:
#IfWinActive, ahk_class Notepad++
~<::
Input, UserInput, L1 V
if UserInput=/ Send, {Backspace 2}^.
return
#IfWinActiveNote: It makes use of the "WinActive" command, so it will only work in a Notepad++ window. Please also note that if you input </ it will first issue 2 Backspace commands before attempting to close the tag, and those characters are deleted whether the tag is closed or not.
In Sum: Notepad# provides you the ability to input Ctrl+. in order to close a tag, which gets us halfway there. And AutoHotKey is then used to map </ to Ctrl+.
Thanks to @user2427906 and also this answer.