Auto close of html tags and jsp, php, asp tags in notepad++ and a semicolon at the end of the line written of scriptlets

70,865

Solution 1

Regarding auto-closing html tags, for me only having html as the language didn't do the trick.

(This answer is incomplete, but is too large for a comment given the images.)


Changing the auto-complete preferences, as below, worked:

  • Settings > Preferences

settings_prefs

  • Auto-Completion tab > Auto-Insert section > html/xml close tag

auto-insert

I use Notepad++ v6.5.2

Solution 2

If you are editing a PHP file and want it to auto-complete the HTML tags, in addition to turning on "Auto-insert HTML/XML tags" in Preferences, you have to change the programming language to HTML while editing that file.

In Notepad++, go to the Language menu, and find HTML and click on it.

This will set the file's language to HTML so that auto-complete tags will work in a PHP file.

Even with the language set to HTML, it still highlights anything in <?php ?> tags as PHP code, and it does not affect auto-closing of brackets, if you have that enabled.

You must have Auto-Insert html/xml close tags on, as mentioned in Noha's answer.

  • Settings > Preferences
  • Auto-Completion tab > Auto-Insert section > html/xml close tag
Share:
70,865
Ravi MCA
Author by

Ravi MCA

Updated on July 09, 2022

Comments

  • Ravi MCA
    Ravi MCA almost 2 years

    I use and I like it

    I specifically want it to do this :

    1. Close automatically HTML tags. (eg. </div>)
    2. Close tags after starting with proper indention for .jsp, .asp, .php files. (eg.<% %>, <?php ?>)
    3. Put a semicolon at the line end by default (whenever I start a new line inside <?php ?>)

    For (1), it is really frustrating for me, when I want to write HTML tags in php files. I upgraded to 6.5.1, and tried the TextFX, but it works only with files which have the extension .html or .htm

    Could someone please guide me in achieving these features?