Community
    • Login

    Default for C++ language

    Scheduled Pinned Locked Moved General Discussion
    6 Posts 3 Posters 1.2k 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.
    • queenidog1Q
      queenidog1
      last edited by

      I only use NPP for editing (printing) C++ programs but I have to choose that language everytime I paste a C++ program into NPP.

      Is there a way to KEEP it as the DEFAULT? i’m sure it worked that way before (before computer crashes, upgrades to win11, new NPP version, etc).

      I would have thought it would be in Preferences

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

        @queenidog1 ,

        Settings > Preferences > New Document > Default Language = C++

        Reference

        • https://npp-user-manual.org/docs/preferences/#new-document
        1 Reply Last reply Reply Quote 2
        • Trevor WT
          Trevor W
          last edited by

          I would like the same.

          The following link may solve your problem @queenigog1, but not mine.

          https://community.notepad-plus-plus.org/topic/11687/change-default-language

          Using this method, the filename extension has to match the language to stay that language each time the files are opened.

          However, my CAD software expects a different file extension (.px) to the language used (.pas)

          I would like to suggest making the default language the last language used.

          Therefore, since most people switch languages infrequently, this should suit all.

          Maybe with a switch in setting if people do or don’t want the option.

          I’m not a coder in C++ so I can’t do this myself.

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

            @trevor-w ,

            However, my CAD software expects a different file extension (.px) to the language used (.pas)

            Then use the Style Configurator to set px as an extra extension for Pascal.

            … because the Default Language only applies to new files, not to opening existing files. If you want a given non-standard extension to always be interpreted as a particular language, you have to tell Notepad++ that.

            1 Reply Last reply Reply Quote 2
            • Trevor WT
              Trevor W
              last edited by

              Thanks Peter, that worked.

              & this should be the solution to @queenidog1 problem too.

              Ta

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

                @trevor-w said in Default for C++ language:

                that worked.

                Glad it worked for you.

                this should be the solution to @queenidog1 problem too.

                Doubtful. As explicitly stated, the original post was about pasting text into a new document (that is, what you get when you open Notepad++ with no previous session open, or what you get from a File>New), whereas your question was how to treat an already-existing file that you open with File>Open or equivalent. Those are two separate things, and the answer I gave to each is the right way of handling those two separate situations.

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