• Login
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 499 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.
  • C
    Cletos
    last edited by Nov 8, 2019, 7:09 AM

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

    D 1 Reply Last reply Nov 8, 2019, 9:44 AM Reply Quote 0
    • D
      dinkumoil @Cletos
      last edited by Nov 8, 2019, 9:44 AM

      @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.
      A 1 Reply Last reply Nov 8, 2019, 1:40 PM Reply Quote 2
      • A
        Alan Kilborn @dinkumoil
        last edited by Nov 8, 2019, 1:40 PM

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

        D 1 Reply Last reply Nov 8, 2019, 2:41 PM Reply Quote 4
        • D
          dinkumoil @Alan Kilborn
          last edited by Nov 8, 2019, 2:41 PM

          @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
          • C
            Cletos
            last edited by Nov 13, 2019, 1:40 PM

            Many thanks, dinkumoil,

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

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