• Login
Community
  • Login

Setting a font specific to .txt files

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 2.9k 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.
  • A
    Asher Stuhlman
    last edited by Aug 13, 2020, 1:40 PM

    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?

    P 1 Reply Last reply Aug 13, 2020, 2:00 PM Reply Quote 0
    • P
      PeterJones @Asher Stuhlman
      last edited by Aug 13, 2020, 2:00 PM

      @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
      • A
        Asher Stuhlman
        last edited by Aug 13, 2020, 3:09 PM

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

        P 1 Reply Last reply Aug 13, 2020, 3:20 PM Reply Quote 0
        • P
          PeterJones @Asher Stuhlman
          last edited by PeterJones Aug 13, 2020, 3:21 PM Aug 13, 2020, 3:20 PM

          @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
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors