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.xml file 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 config.xml file

    • When found, note its location, and just move to that location

    • Now, along with the config.xml file, you should probably see our concerned shortcuts.xml file !

    • First, do a simple copy of shortcuts.xml, as a backup ( useful in case of big problem ! )

    • Open the shortcut.xml file with Microsoft Notepad ( not N++ ! )

    • At the end of this file, add the two sections, below :

            <PluginCommand moduleName="YourPluginName" internalID="#" Ctrl="no" Alt="no" Shift="yes" Key="13" />
            <ScintKey ScintID="2329" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="13" />

    Remarks :

    • Of course, in the <PluginCommand moduleName="Your plugin name" internalID="#" ......... command, simply change YourPluginName with the correct name of your plugin/script and change the # symbol with its Internal ID number ( 0, 1,…)

    • The PluginCommands and ScintillaKeys sections may, already, be present , if you previously modified some default plugin shortcuts and/or some default Scintilla shortcuts

    • The <ScintKey ScintID="2329".... command modifies the default shortcuts of the SCI_NEWLINE function of Scintilla, forcing the only Enter shortcut, for this command !

    • Now valid the changes of shortcuts.xml and close Microsoft Notepad

    • Start your current N++ installation

    => From now on, the Shift+ Enter shorcut should be mapped to your Python script ;-))

    I tested this method, on a portable installation of the last 7.6 version of N++, changing the default shortcut to enable/disable DSpellCheck ( Alt + A ) to the new Shift+Enter shortcut, without any trouble !

    Best Regards,


    P.S :

    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++

  • hello @guy038,

    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.

    Best regards,

  • @bitagoras Added a link to your project to 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.

Log in to reply