Community
    • Login

    PyPadPlusPlus: Shift+Enter not accessible for shortcut

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 1.3k 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.
    • bitagorasB
      bitagoras
      last edited by

      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:
      https://github.com/bitagoras/PyPadPlusPlus

      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:
      https://stackoverflow.com/questions/10272192/notepad-insert-line-below-with-sift-enter-like-in-eclipse

      1 Reply Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by guy038

        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 :

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

        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 PyPadExecute.py 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,

        guy038

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

        1 Reply Last reply Reply Quote 3
        • bitagorasB
          bitagoras
          last edited by

          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

          1 Reply Last reply Reply Quote 2
          • chcgC
            chcg
            last edited by

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

            1 Reply Last reply Reply Quote 0
            • bitagorasB
              bitagoras
              last edited by

              @chcg Thank you very much for the link! I renamed the title respectively.

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