Menu

Filename --> Language --> Style?

2008-05-05
2012-11-13
  • Nobody/Anonymous

    I have some special txt files (like "abc.txt") that have comments inside that are marked with a preceeding "#".

    How can I make Notepad++ display them with a special Style per default?
    Right now they are recognized as text files and I can select e.g. "Properties" from the "Languages" menu. That works fine, but is there a way to assign special filenames to Languages so that I don't have to do that manually each time?

     
    • Nobody/Anonymous

      "Changing EXT in stylers.xml doesnt highlight" (Help forum)
      http://sourceforge.net/forum/forum.php?thread_id=1993106&forum_id=331754

       
      • Nobody/Anonymous

        Thanks, but that only explains how to add/delete styles.

        My problem is that the language seems only to be recognized by extension, not by filename.
        While most of my files that end on .txt are plain textfiles that shouldn't show any highlighting at all some of them are configuration files with comments and syntax. But they also end on .txt which can't be changed, so I wondered how to deal with that and assign the correct style.

         
        • Nobody/Anonymous

          I guess you can't.

          There is no way to distinguish between filenames, other than the extension for language styles. If you have not much files, I assume it isn't too much effort to manually change the language.

           
          • gfxcat

            gfxcat - 2008-07-09

            I am having this issue too.

            I use the .txt file extension for config files that I want to apply special syntax highlighting too.

            Is there a way to provide a regular expression for the whole filename as opposed to just looking at the file extension.

            if not, can I create a special style within the .txt language definition based on the filename?