Community
    • Login

    How could one sort the files in the "Recent Files" menu in "Files" by date / last closed or alphabet?

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 3 Posters 943 Views 2 Watching
    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.
    • CletosC Offline
      Cletos
      last edited by

      How could one sort the files in the “Recent Files” menu in “Files” by date / last closed or alphabet?

      dinkumoilD 1 Reply Last reply Reply Quote 0
      • dinkumoilD Offline
        dinkumoil @Cletos
        last edited by

        @Cletos

        • Sorting of the recent files list by “last closed” order would require changes to the Notepad++ code base, thus you should file a feature request in the issue tracker. Read this help desk entry to learn how to do that.
        • Sorting the list by file date would require scripting. Since this is not a scripting forum you should look for support at another website.
        • Alphabetical sorting of the recent files list can be done with the help of the following XSLT code:
        <?xml version="1.0" encoding="Windows-1252"?>
        
        <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        
          <xsl:output
            method="xml"
            encoding="Windows-1252"
            indent="yes"
            omit-xml-declaration="no"
          />
        
          <xsl:template match="@*|node()">
            <xsl:copy>
              <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
          </xsl:template>
        
          <xsl:template match="/NotepadPlus/History">
            <xsl:copy>
              <xsl:copy-of select="@*"/>
              <xsl:apply-templates select="File">
                <xsl:sort select="@filename"/>
              </xsl:apply-templates>
            </xsl:copy>
          </xsl:template>
        
        </xsl:transform>
        

        To apply that code on the Notepad++ settings file you need msxsl.exe, a command line XSLT processor released by Microsoft. You can download it >>> here <<< or just google for msxsl.exe.

        With the following commands executed from a console window you can sort the recent files list:

        ren "%AppData%\Notepad++\config.xml" "config_backup.xml"
        msxsl "%AppData%\Notepad++\config_backup.xml" "<Path-to-file-with-above-XSLT-code>" -o "%AppData%\Notepad++\config.xml"
        

        Please note:

        • Run these commands only when there is no running instance of Notepad++.
        • The commands assume you use an installed version of Notepad++. If you use a portable version you have to adjust the path to the file config.xml.
        • The commands back up your original config.xml to a file named config_backup.xml in its original location, thus you won’t loose your original file.
        Alan KilbornA 1 Reply Last reply Reply Quote 2
        • Alan KilbornA Offline
          Alan Kilborn @dinkumoil
          last edited by

          @dinkumoil said in How could one sort the files in the "Recent Files" menu in "Files" by date / last closed or alphabet?:

          Sorting of the recent files list by “last closed” order would require changes to the Notepad++ code base,

          Isn’t the list already in “last closed” order? Maybe I’m missing something, or I don’t understand the meaning of “last closed”.

          dinkumoilD 1 Reply Last reply Reply Quote 4
          • dinkumoilD Offline
            dinkumoil @Alan Kilborn
            last edited by

            @Alan-Kilborn said in How could one sort the files in the "Recent Files" menu in "Files" by date / last closed or alphabet?:

            Isn’t the list already in “last closed” order?

            You are right, it is. The last closed file is the top one. Never noticed that as I normally work with so much different files that the “Recent Files” list is mostly useless for me.

            1 Reply Last reply Reply Quote 3
            • CletosC Offline
              Cletos
              last edited by

              Many thanks, dinkumoil,

              for the instructions, very easily done. Works great! Many thanks again!

              1 Reply Last reply Reply Quote 1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors