The 'shortcuts.xml' file is NOT re-created if you delete it, on purpose or by mistake !
-
Hi All,
One week ago, I was testing some shortcuts on a new portable version
v8.8
. Particularly, the Scintilla messagesSCI_DELETEBACK
andSCI_DELETEBACKNOT LINE
!By default :
-
The
SCI_DELETEBACKNOTLINE
message has NO defined shortcut -
The
SCI_DELETEBACK
message has two defined shortcuts :Backspace
andShift + Backspace
So, I wanted to change this behavior and tried to get this configuration :
-
Define the
Backspace
shortcut for theSCI_DELETEBACKNOTLINE
message -
Define the
Shift + Basckspace
shortcut for theSCI_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 theSCI_DELETEBACKNOTLINE
message -
However, I got things a bit mixed up and it was impossible to, both, reallocate the shortcuts,
Backspace
andShift + Backspace
, simultaneously, to theSCI_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...
commandAfter 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
andShift + Backspace
, to theSCI_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 theStylers.model.xml
file, if absent when starting N++ -
The
langs.xml
file is created from thelangs.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
-
-
@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])
-
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. :-)
-
@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.
-
@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
-
@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)