• Login
Community
  • Login

The 'shortcuts.xml' file is NOT re-created if you delete it, on purpose or by mistake !

Scheduled Pinned Locked Moved General Discussion
6 Posts 5 Posters 566 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.
  • G
    guy038
    last edited by guy038 May 16, 2025, 2:29 PM May 16, 2025, 2:27 PM

    Hi All,

    One week ago, I was testing some shortcuts on a new portable version v8.8. Particularly, the Scintilla messages SCI_DELETEBACK and SCI_DELETEBACKNOT LINE !

    By default :

    • The SCI_DELETEBACKNOTLINE message has NO defined shortcut

    • The SCI_DELETEBACK message has two defined shortcuts : Backspace and Shift + Backspace

    So, I wanted to change this behavior and tried to get this configuration :

    • Define the Backspace shortcut for the SCI_DELETEBACKNOTLINE message

    • Define the Shift + Basckspace shortcut for the SCI_DELETEBACK message

    These changes implies this new behavior :

    • The hit of the Backspace key always stops at the very beginning of each line

    • The hit of the Shift + Backspace shortcut allow to go on upwards, deleting characters on the previous line(s)

    I did get this expected configuration. Then, I decided to get the default behavior again :


    • I was able to suppress the Backspace shortcut for the SCI_DELETEBACKNOTLINE message

    • However, I got things a bit mixed up and it was impossible to, both, reallocate the shortcuts, Backspace and Shift + Backspace, simultaneously, to the SCI_DELETEBACK message

    I said to myself : no problem. Let’s delete the shortcut.xml file, close N++ and a new clean shortcuts.xml file will be created !

    I was really surprised to discover that NO new shortcuts.xml file has been created !

    Then, I restarted N++ and decided to create a first shortcut, related to the View > Summary... command

    After closing N++ and viewing the shortcuts.xml file, it contained this only shortcut :

    <NotepadPlus>
        <InternalCommands>
            <Shortcut id="44049" Ctrl="yes" Alt="no" Shift="no" Key="186" />
        </InternalCommands>
        <Macros />
        <UserDefinedCommands />
        <PluginCommands />
        <ScintillaKeys />
    </NotepadPlus>
    

    After reflexion, I thought that I should NOT have deleted the shortcuts.xml file but simply deleted this line :

            <ScintKey ScintID="2326" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="8" />
    

    And relaunched N++. This automatically would reallocate the two shortcuts, Backspace and Shift + Backspace, to the SCI_DELETEBACK message !


    So, just one question :

    • Is is normal that a default shortcuts.xml file is NOT created if absent in current folder ( for a portable version ) ?

    Of course, I knows that :

    • The Stylers.xml file is created from the Stylers.model.xml file, if absent when starting N++

    • The langs.xml file is created from the langs.model.xml file, if absent when starting N++

    • The Session.xml file is simply created from scratch, if absent when starting N++

    Best Regards,

    guy038

    P 1 Reply Last reply May 16, 2025, 3:52 PM Reply Quote 1
    • P
      PeterJones @guy038
      last edited by May 16, 2025, 3:52 PM

      @guy038 said in The 'shortcuts.xml' file is NOT re-created if you delete it, on purpose or by mistake !:

      Is is normal that a default shortcuts.xml file is NOT created if absent in current folder ( for a portable version )

      I can confirm the behavior. I tried with v8.8.1, then back to v8.0, so I think this is expected/designed behavior (I didn’t try farther back than that).

      The “installed” or “cloud” behavior will be different:

      • If you run N++ when the settings directory (AppData or cloud-folder) has no shortcuts.xml, but there is a shortcuts.xml next to notepad++.exe, then it will copy the installation’s version to the settings directory
      • If you run N++ when neither the settings directory nor the exe directory have shortcuts.xml, it has nothing to copy

      So N++ is treating the copy of shortcuts.xml in the exe directory similarly to the “*.model.xml” files in the exe directory. Since the portable doesn’t have a shortcuts.xml in the “exe” directory, it has nothing to copy from, so does not create an empty one. (Similar will happen if a portable or cloud or installed doesn’t have langs.model.xml – if you delete the settings-dir copy of langs.xml, it has no .model. to copy from, and complains at you [but then runs, just with no keyword lists or file extensions defined])

      D 1 Reply Last reply Jun 16, 2025, 4:00 AM Reply Quote 5
      • A
        Alan Kilborn
        last edited by Alan Kilborn May 16, 2025, 5:04 PM May 16, 2025, 5:01 PM

        It sort of makes sense… shortcuts.xml is really just a bunch of overrides… so it isn’t really necessary to be there.

        For keycombos, all of the defaults are still there, even without a shortcuts.xml file.

        so I think this is expected/designed behavior

        Or probably, “just never considered” behavior. :-)

        1 Reply Last reply Reply Quote 2
        • D
          deleelee @PeterJones
          last edited by Jun 16, 2025, 4:00 AM

          @PeterJones said in The 'shortcuts.xml' file is NOT re-created if you delete it, on purpose or by mistake !:

          Since the portable doesn’t have a shortcuts.xml in the “exe” directory

          Perhaps I’m misunderstanding your meaning but, if the “exe” directory is the one containing notepad++.exe, the portable version does have shortcuts.xml there.

          P 1 Reply Last reply Jun 16, 2025, 1:29 PM Reply Quote 0
          • N
            notdodgeball
            last edited by Jun 16, 2025, 1:14 PM

            @guy038, related to your original intent of altering the behavior of the backspace key,

            <ScintKey ScintID="2344" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="8" />
            <ScintKey ScintID="2326" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="8" />
            

            those lines will do the trick, but they have to be added directly in the shortcuts.xml file. It appears it’s impossible to change it through the interface

            1 Reply Last reply Reply Quote 1
            • P
              PeterJones @deleelee
              last edited by Jun 16, 2025, 1:29 PM

              @deleelee said in The 'shortcuts.xml' file is NOT re-created if you delete it, on purpose or by mistake !:

              Perhaps I’m misunderstanding your meaning but, if the “exe” directory is the one containing notepad++.exe, the portable version does have shortcuts.xml there.

              You ignored the context of the discussion: the specific question @guy038 asked was,

              Is is normal that a default shortcuts.xml file is NOT created if absent in current folder ( for a portable version )

              Or, phrases a different way: “if you delete the shortcuts.xml and start Notepad++, why doesn’t it re-create it with default shortcuts”

              So, definitionally, if you’ve deleted the shortcuts.xml from the portable directory, there is no shortcuts.xml from which NPP can read the defaults, since NPP doesn’t have a .model for shortcuts.xml and it has no where else to look. (I was contrasting that to the normal installation, where if you delete the App data shortcuts.xml, NPP can recreate it using the shortcuts.xml in the exe directory)

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