How to change default language for file extension



  • I’m working with express applications at the moment using handlebars (.hbs files). How can i make HTML the default language for .hbs files? (I’ve tried “settings/preferences/file associations” but I can’t seem to edit anything)



  • @Ruairí-Murphy said in How to change default language for file extension:

    How can i make HTML the default language for .hbs files?

    Settings > Style Configurator > Language: HTML, User Ext: = hbs (or, if there were already one, like User Ext: hta, then change to space separated hta hbs (no dots))

    see also: Style Configurator doc



  • Hi,

    I did that, however, the settings don’t take effect. I was in admin mode while making those settings and despite restarting NPP, the settings don’t seem to take any effect.

    Any clue where I’m going wrong?
    Thanks.



  • Sorry for the double post.

    Just wanted to add that my NPP version is v7.8.7 64bit



  • @dbdonb said in How to change default language for file extension:

    I did that, however, the settings don’t take effect. I was in admin mode while making those settings and despite restarting NPP, the settings don’t seem to take any effect.

    You shouldn’t need to be in Admin Mode for that change.

    The following sequence works just fine for me:

    1. Go to Settings > Style Configurator > HTML, and type rbs into the User ext. box, then hit Save & Close
      e536cdd3-d57f-485e-9d17-52bef42bfb64-image.png
    2. File > New
    3. File > Save As, select Save as type as either All Types (*.*) or Hyper Text Markup Language file (*.html; ...), and type blah.rbs, then Save
    4. At this point, the status bar shows (in the lower left, if the window is wide enough) that blah.rbs is a Hyper Text Markup Language file, and if I enter HTML or pseudo-html, it highlights as expected:
      52efcbe4-2831-4414-8784-55388b071de0-image.png

    This feature has worked for me in every version of Notepad++ I have used for the last 5+ years, including v7.8.7-64bit.

    If your experience is different, you will have to give an explanation of the exact sequence of steps, and we can try to replicate your problem.

    But for now, “it works for me”



  • @PeterJones Thanks a lot for this splendid explanation. I really appreciate it. Apologies for my delayed response.

    However, I realised that the reason a particular custom extension wasn’t working for me was that it is already defined in the default of another language.

    I need “inc” to be opened in C language, however, it’s by default defined in Pascal. I guess if I am able to remove it from the Pascal defaults, things would work for me.

    66f817ff-d645-4535-ac4a-86bb498130e2-image.png

    I Would be grateful if you could kindly guide me in how to remove a default extension from a language.

    Regards



  • Update:

    Sorry for double posting. The edit time is way too less (3 minutes!)

    I figured out editing the default extension I guess. I edited the langs.xml and removed inc from Pascal.

    It now loads the custom syntax hughlighting ( C Language) for .inc

    However, I hope what I’ve done won’t break anything else in the system, and also hope that this is how it’s supposed to be done.

    Kindly correct me if wrong.

    Regards



  • @dbdonb ,

    hope that this is how it’s supposed to be done.

    You are given access to plaintext (XML) config files in Notepad++ because the developers want you to be able to have as full control over the application as you can. Edit config files to your heart’s content. :-)


Log in to reply