Community
    • Login

    Setting a font specific to .txt files

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 2.7k 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.
    • Asher StuhlmanA
      Asher Stuhlman
      last edited by

      I use Notepad++ to edit .txt files in addition to editing code, and I would like to use a monospaced font for all files except .txt files.

      If I had a specific language I wanted to use a different font for, I could use the Style Configurator to set the font for that language. But I can’t find a way to set the font for .txt files. How can I do this?

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

        @Asher-Stuhlman ,

        Style Configurator > Global Styles > Default Style is the style used for normal text (.txt) or any unknown file-types.

        1 Reply Last reply Reply Quote 1
        • Asher StuhlmanA
          Asher Stuhlman
          last edited by

          @PeterJones I’m familiar with that feature, but I would like to use monospaced font for unknown file types and a specific font only for .txt files if possible.

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

            @Asher-Stuhlman ,

            I would like to use monospaced font for unknown file types and a specific font only for .txt files if possible.

            That’s not the way that Notepad++ works. All unknown file extensions are interpreted by Notepad++ as “Normal Text”, and all Normal Text, whether it ends in .txt or not, get the Default Style applied. That’s the way Notepad++ was designed.

            You might be able to get your desired behavior by creating a User Defined Language (UDL) associated with the .txt extension, and use the UDL dialog to set the font for just .txt. (This would override .txt so it’s using the UDL lexer, and is no longer considered “Normal Text”)

            • official UDL overview: https://npp-user-manual.org/docs/user-defined-language-system/
            • UDL details: https://ivan-radic.github.io/udl-documentation/
            1 Reply Last reply Reply Quote 4
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors