• Login
Community
  • Login

Default User Defined Language ?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 4 Posters 2.6k 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.
  • X
    XiarnoYTooShort
    last edited by Aug 14, 2019, 10:01 PM

    Is there a way to make user defined language by default?
    I’ve been searching for 1h and the only thing I found are post from over 3 years ago, which are probably outdated.

    Thanks.

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by Aug 14, 2019, 10:15 PM

      I am assuming you mean “set a specific UDL as the default language for a new file” – akin to Settings > Preferences > New Document > Default Language, but with the ability to select a UDL rather than a builtin.

      I don’t know of a way directly.

      However, if you have your UDL defined with a particular extension, then if you create a new file and immediately save-as to a filename with that extension, and it will immediately change over to that UDL. (This has the side benefit of immediately naming your file, so you’re not trying to figure out two days later “which file was new 1, which was new 42, …?”)

      1 Reply Last reply Reply Quote 1
      • X
        XiarnoYTooShort
        last edited by Aug 14, 2019, 10:21 PM

        Well, I want the first thing you mentionned.

        For the second thing, I guess that can work. But first, how do do that? And second, mine is not a coding language. It just need to be a txt with SOME modification (My modification is only folding. Literally nothing else)

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones
          last edited by Aug 15, 2019, 1:17 PM

          @XiarnoYTooShort said:

          how do do that?

          How do you do what? I assume you know how to save a file with a specific extension. Given that you implied you already had a UDL, I had originally thought you would know how to add an extension to UDL, but if not: Go to Language > Define your language, select your desired language from the pulldown, and in the Ext.: box, type the extension (without the dot, using spaces to separate multiple extensions) – so, for example, I have a customized Markdown UDL, so I entered md markdown in that box, so files that end in .md or .markdown utilize that UDL.

          If you happen to use an extension (like txt) that defaults to some other lanugage, Notepad++ will see that you used that extension for your UDL instead, and will apply the UDL rather than the default language for that extension.

          second, mine is not a coding language

          Notepad++ and UDL don’t care whether they are programming languages, text formatting languages, or anything else that you want to apply lexing, syntax highlighting, and/or folding to: it doesn’t matter whether you’re defining D-flat-plus-minus programming, Ultra-Markup-Markside-Ubertext, a specific flavor of XML-based markup, a syntax for making simple TODO lists with folding, or a movie subtitle file – they are all treated the same, and called a “language”.

          A 1 Reply Last reply Aug 15, 2019, 1:24 PM Reply Quote 2
          • A
            Alan Kilborn @PeterJones
            last edited by Aug 15, 2019, 1:24 PM

            @PeterJones said:

            I have a customized Markdown UDL

            Oooh, is it cool? Care to share? :)

            1 Reply Last reply Reply Quote 0
            • P
              PeterJones
              last edited by Aug 15, 2019, 1:29 PM

              @Alan-Kilborn said:

              Oooh, is it cool? Care to share? :)

              Not really cool; it’s just one I made before Don started shipping his Markdown UDL with Notepad++, and I got used to it’s quirks, so haven’t transferred over to using Don’s quirks instead.

              But if you want to try to convert your quirks:

              <NotepadPlus>
                  <UserLang name="Markdown" ext="md markdown readme" udlVersion="2.1">
                      <Settings>
                          <Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
                          <Prefix Keywords1="yes" Keywords2="yes" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="no" />
                      </Settings>
                      <KeywordLists>
                          <Keywords name="Comments">00# 01 02((EOL)) 03&lt;!-- 04--&gt;</Keywords>
                          <Keywords name="Numbers, prefix1"></Keywords>
                          <Keywords name="Numbers, prefix2"></Keywords>
                          <Keywords name="Numbers, extras1"></Keywords>
                          <Keywords name="Numbers, extras2"></Keywords>
                          <Keywords name="Numbers, suffix1">.</Keywords>
                          <Keywords name="Numbers, suffix2">.</Keywords>
                          <Keywords name="Numbers, range"></Keywords>
                          <Keywords name="Operators1">@ &lt; &gt; \&lt; \&gt; \\ \` \_ \{ \} \[ \] \( \) \# \+ \- \. \! \~ :|: |: :| | \|</Keywords>
                          <Keywords name="Operators2">* - +</Keywords>
                          <Keywords name="Folders in code1, open"></Keywords>
                          <Keywords name="Folders in code1, middle"></Keywords>
                          <Keywords name="Folders in code1, close"></Keywords>
                          <Keywords name="Folders in code2, open"></Keywords>
                          <Keywords name="Folders in code2, middle"></Keywords>
                          <Keywords name="Folders in code2, close"></Keywords>
                          <Keywords name="Folders in comment, open"></Keywords>
                          <Keywords name="Folders in comment, middle"></Keywords>
                          <Keywords name="Folders in comment, close"></Keywords>
                          <Keywords name="Keywords1">http:// (http:// https:// (https:// mailto: (mailto: ftp:// (ftp:// ftps:// (ftps:// (/ / file:// (file://</Keywords>
                          <Keywords name="Keywords2">==== ----</Keywords>
                          <Keywords name="Keywords3">*** ___</Keywords>
                          <Keywords name="Keywords4">** __</Keywords>
                          <Keywords name="Keywords5">* _</Keywords>
                          <Keywords name="Keywords6">** __</Keywords>
                          <Keywords name="Keywords7">* _</Keywords>
                          <Keywords name="Keywords8"></Keywords>
                          <Keywords name="Delimiters">00![ 00[ 01\ 02] 02] 03``` 03` 03~~~ 04\ 05``` 05((EOL `)) 05~~~ 06*** 07\ 08((EOL ***)) 09** 10\ 11((EOL **)) 12* 13\ 14((EOL *)) 15** 16\ 17((EOL **)) 18* 19\ 20((EOL *)) 21~~ 22\ 23~~</Keywords>
                      </KeywordLists>
                      <Styles>
                          <WordsStyle name="DEFAULT" fgColor="333333" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="LINE COMMENTS" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="67108864" />
                          <WordsStyle name="NUMBERS" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="KEYWORDS1" fgColor="408080" bgColor="FFFFFF" fontName="" fontStyle="4" nesting="0" />
                          <WordsStyle name="KEYWORDS2" fgColor="FF8080" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                          <WordsStyle name="KEYWORDS3" fgColor="000080" bgColor="FFFFA0" fontName="" fontStyle="3" nesting="0" />
                          <WordsStyle name="KEYWORDS4" fgColor="400080" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                          <WordsStyle name="KEYWORDS5" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
                          <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="OPERATORS" fgColor="0000FF" bgColor="FFFF00" fontName="" fontStyle="1" nesting="0" />
                          <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="DELIMITERS1" fgColor="408080" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                          <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="CCFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="DELIMITERS3" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                          <WordsStyle name="DELIMITERS4" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          <WordsStyle name="DELIMITERS8" fgColor="C0C0C0" bgColor="FFFFFF" fontName="" fontStyle="4" nesting="0" />
                      </Styles>
                  </UserLang>
              </NotepadPlus>
              
              B 1 Reply Last reply Sep 6, 2023, 9:33 PM Reply Quote 2
              • B
                Bobbster Lobster @PeterJones
                last edited by Sep 6, 2023, 9:33 PM

                Very old thread, but little hack-around I found. Suppose you want .md to be the default extension (and assuming your current default language is “None (Text)”:

                1. open langs.xml
                2. just add the md extension to the “normal” language, i.e.
                <Language name="normal" ext="md txt"/>
                

                Now md will be the default extension!

                By the way thanks @PeterJones for your md UDL!

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