Community
    • Login

    How to change default language for file extension

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 7.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      Ruairí Murphy
      last edited by

      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)

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by PeterJones

        @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

        1 Reply Last reply Reply Quote 2
        • dbdonbD
          dbdonb
          last edited by

          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.

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • dbdonbD
            dbdonb
            last edited by

            Sorry for the double post.

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

            1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @dbdonb
              last edited by

              @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”

              dbdonbD 1 Reply Last reply Reply Quote 2
              • dbdonbD
                dbdonb @PeterJones
                last edited by

                @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

                1 Reply Last reply Reply Quote 0
                • dbdonbD
                  dbdonb
                  last edited by dbdonb

                  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

                  PeterJonesP 1 Reply Last reply Reply Quote 2
                  • PeterJonesP
                    PeterJones @dbdonb
                    last edited by

                    @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. :-)

                    1 Reply Last reply Reply Quote 2
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors