PyPadPlusPlus: Shift+Enter not accessible for shortcut
In the Shortcut mapper you can remove the scintilla shortcut Shift+Enter from SCI_NEWLINE, but it cannot be mapped to anything else. Why?
I developed a new extension that turns Notepad++ into an interactive Python environment:
An essential feature of PyPadPlusPlus is running lines of code or blocks of code like in Jupyter, where you can run cells with Shift+Enter. In Notepad++ I wanted to use the same shortcut, but only Ctrl+Enter worked. Is this possible somehow? Someone posted a solution, but this did not work for me:
Hello, @bitagoras and All,
The most important thing is to find out, first, where is your ACTIVE configuration file
shortcuts.xml, indeed ! It depends on your previous way of installing N++ and of your current N++ version
As for me, I’m always using portable versions of N++, where configuration files are simply located in an arbitrary installation directory, or in its sub-folders. So, I’m not really acquainted with N++ installation with the installer :-(
But here are some hints to solve your problem !
As Notepad++ always updates the
config.xmlfile when current session ends, the more simple would be :
Start N++ and close it almost immediately
Then, try to find out, in the list of the last modified files, of your system, any
When found, note its location, and just move to that location
Now, along with the
config.xmlfile, you should probably see our concerned
First, do a simple copy of
shortcuts.xml, as a backup ( useful in case of big problem ! )
shortcut.xmlfile with Microsoft Notepad ( not N++ ! )
At the end of this file, add the two sections, below :
<PluginCommands> <PluginCommand moduleName="YourPluginName" internalID="#" Ctrl="no" Alt="no" Shift="yes" Key="13" /> </PluginCommands> <ScintillaKeys> <ScintKey ScintID="2329" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="13" /> </ScintillaKeys>
Of course, in the
<PluginCommand moduleName="Your plugin name" internalID="#" .........command, simply change
YourPluginNamewith the correct name of your plugin/script and change the
#symbol with its Internal ID number (
ScintillaKeyssections may, already, be present , if you previously modified some default plugin shortcuts and/or some default Scintilla shortcuts
<ScintKey ScintID="2329"....command modifies the default shortcuts of the SCI_NEWLINE function of Scintilla, forcing the only
Entershortcut, for this command !
Now valid the changes of
shortcuts.xmland close Microsoft Notepad
Start your current N++ installation
=> From now on, the
Shift+ Entershorcut should be mapped to your PyPadExecute.py Python script ;-))
I tested this method, on a portable installation of the last
7.6version of N++, changing the default shortcut to enable/disable DSpellCheck (
Alt + A) to the new
Shift+Entershortcut, without any trouble !
I forgot to add that your present shortcut
Ctrl + Enter, is already used as default shortcut for the option Edit> Auto-Completion >Word Completion of N++
wow, thank you for such a detailed and nice answer! It really worked. The strange thing is, that you cannot define the same shortcut via the menu. The “OK” button stays gray, even there is no conflict. But it works when you add it in shortcuts.xml, as you described. Thank you for your help.
I hope, I can make some install script, so that the user of my extension does not need to perform all these steps. I probably have to parse and modify the xml files, which can be a little bit dangerous. I’ll think about it.
@bitagoras Added a link to your project to https://github.com/bruderstein/PythonScript. Would not title your work as N++ plugin, but as addon to the PythonScript plugin, because it is not directly connected to the plugin interface of N++.
@chcg Thank you very much for the link! I renamed the title respectively.