Make NPP list its current shorcut key assignments?
-
The Shortcut Mapper seems not to mind if I assign a shortcut key that’s already in use. It won’t notify me when I’ve done that. My only clue will be that nothing happens when I type the shortcut: neither the function I just assigned nor the one that was already assigned will run. At least that’s what happened in the one experiment that I tried.
But obviosly NPP knows what all of its key bindings are. Is there a way to search for a given key combination in Shortcut Mapper (doing it visually is pretty tedious, since there’s no recognizable / usable sort order), or to make NPP dump all of its current key bindings to a table in a file in human-readable format (e.g. “Ctrl-S Save” or vice versa)?
-
Hello Matt
The Shortcut Mapper seems not to mind if I assign a shortcut key that’s already in use.
correct
It won’t notify me when I’ve done that. My only clue will be that nothing happens when I type the shortcut: neither the function I just assigned nor the one that was already assigned will run. At least that’s what happened in the one experiment that I tried.
That’s different from my experience, it looks like it is a first found, execute. That nothing happened could mean,
that the shortcut hasn’t anything to do in the current situation.But obviosly NPP knows what all of its key bindings are. Is there a way to search for a given key combination in Shortcut Mapper (doing it visually is pretty tedious, since there’s no recognizable / usable sort order), or to make NPP dump all of its current key bindings to a table in a file in human-readable format (e.g. “Ctrl-S Save” or vice versa)?
Unfortunattely, no. What could be done is to get the list defined by npp itself (from npp’s source code) but all plugins are missed.
Cheers
Claudia -
This is a long-requested feature that still is not implemented. :(
-
But obviosly NPP knows what all of its key bindings are. Is there a way to search for a given key combination in Shortcut Mapper (doing it visually is pretty tedious, since there’s no recognizable / usable sort order), or to make NPP dump all of its current key bindings to a table in a file in human-readable format (e.g. “Ctrl-S Save” or vice versa)?
Unfortunattely, no. What could be done is to get the list defined by npp itself (from npp’s source code) but all plugins are missed.
Well, I’m not surprised to hear that I’m not the only one who would like this feature. It seems to me that whatever code populates the lists in the Shortcut Mapper could be adapted pretty quickly to serve this purpose.
That said, the workaround of peeking into the source code might be acceptable, if it is only plugins that are missed. In my installation, there are only five key bindings for plugins, including one custom key binding that I created yesterday. Not too hard to keep track of that. How / where would I find the relevant code?
Matt
-
Hello Matt
I assume that parameters.cpp has it all (except the plugins of course).
Cheers
Claudia -
I actually tackled solving this problem (getting a list of the current keymap in effect) once. What I wanted was a dump to text file of “function : keycombo”, for example in my case:
Save All : Ctrl+Shift+S
Exit : Alt+F4
etc.I mostly finished it, using Python (not the Pythonscript plugin, just normal Python), and I seem to recall that it involved the following files to get all of the data:
parameters.cpp
english.xml
keys.h
menuCmdID.h
Scintilla.h
shortcuts.xmlIt truly is not an easy (straightforward) thing, and I’m not sure I took it all the way to the end and did plugin keystrokes (since they are an additional degree of difficulty).
I’m still hopeful that one day this kind of thing will be built in to N++: A “Dump keymap to text file” menu option in all likelihood.
-
Hi Scott,
it is even worse than I thought. About the plugins, I don’t think this can be done.
As far as I understand the plugin informs npp about its shortcuts (must be provided within the func… structure)
when gets loaded and do you think you find this python script again ;-)I’m haveing the same hope, this is something which would be really helpful.
Thank you
Claudia -
I vote for a list of printable short cut keys as well as a search on the keyboard mapper/ warning for allocated allready if trying to change to an allready allocated combination.
-
Future reference:
More of the solution to this, with example scripts, is found here