• Login
Community
  • Login

Remove Consecutive Duplicate Lines - How to add in Shortcut mapper?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
shortcut mapperduplicateremovelines
11 Posts 4 Posters 1.5k 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.
  • E
    eltrkbrd
    last edited by Jun 26, 2019, 8:58 PM

    Remove Consecutive Duplicate Lines - How to add in Shortcut mapper?

    How do I assign a keyboard shortcut to the “Line Operations” menu option for “Remove Consecutive Duplicate Lines” in Notepad++?

    I would like to add a keyboard shortcut for this built-in np++ menu command but I don’t see it as an option listed under the Shortcut Mapper (not even scintilla commands).

    It’s listed as “IDM_EDIT_REMOVE_DUP_LINES” in https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/menuCmdID.h

    I’m thinking this is a bug. How would I go about adding it as an Internal Command to Keyboard shortcuts in shortcuts.xml as described in the link below?
    http://docs.notepad-plus-plus.org/index.php/Editing_Configuration_Files#.3CInternalCommands.3E

    I have limited programming abilities and previously was fond of textfx for sort & dedupe before x64 crippled it.

    Thank you

    A 1 Reply Last reply Jun 26, 2019, 9:29 PM Reply Quote 1
    • A
      Alan Kilborn @eltrkbrd
      last edited by Jun 26, 2019, 9:29 PM

      @eltrkbrd

      I’m AFK right now (well, my keyboard attached to a computer that has Notepad++) so I can’t test it, but you might consider recording a macro consisting of a single command and then typing that to your desired keycombo, as a workaround.

      1 Reply Last reply Reply Quote 1
      • E
        eltrkbrd
        last edited by eltrkbrd Jun 26, 2019, 10:00 PM Jun 26, 2019, 9:58 PM

        Thanks for you reply but I tried your suggestion and it doesn’t seem possible to create a macro by recording and running the Remove Consecutive Duplicate Lines (dedupe) menu command so that I can assign a keyboard shortcut to it.

        Also I found that shortcut.xml can assign custom internal commands to keyboard shortcuts.

        However, it doesn’t appear as though the dedupe command I want has an ID in the table here: https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/nativeLang/english_customizable.xml

        1 Reply Last reply Reply Quote 0
        • E
          eltrkbrd
          last edited by eltrkbrd Jun 26, 2019, 10:58 PM Jun 26, 2019, 10:55 PM

          Thanks for you reply but I tried your suggestion and it doesn’t seem possible to create a macro by recording and running the Remove Consecutive Duplicate Lines (dedupe) menu command so that I can assign a keyboard shortcut to it.

          Also I found that shortcut.xml can assign custom internal commands to keyboard shortcuts which I’m currently experimenting making changes to by using the Shortcut mapper and then restarting Notepad++ to save changes.

          The “Remove Consecutive Duplicate Lines” menu command is listed as ID # 42077 in https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/nativeLang/english.xml

          And also as “IDM_EDIT_REMOVE_DUP_LINES” in https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/menuCmdID.h

          I also tried the NppExec plugin to no avail as posted here - https://stackoverflow.com/questions/34609009/notepad-adding-a-new-shortcut-for-an-existing-command

          P.S.
          Sorry for the redundant post; I can’t delete the old one above with typos and grammatical errors…

          A 1 Reply Last reply Jun 27, 2019, 1:49 AM Reply Quote 1
          • A
            Alan Kilborn @eltrkbrd
            last edited by Jun 27, 2019, 1:49 AM

            @eltrkbrd

            It seems as if you are well on your way to a solution for yourself.

            1 Reply Last reply Reply Quote 0
            • E
              eltrkbrd
              last edited by Jun 29, 2019, 2:32 AM

              I wasn’t able to map out a keyboard shortcut for the “Remove Consecutive Duplicate Lines” menu (internal) command to shortcut.xml via Shortcut mapper as described above.

              I’m confident I went about it the right way, however it seems like a bug or inherent limitation within the notepad++ software that is preventing me from replacing the ids from other internal commands I successfully created from within shortcut mapper with the correct internal command ID (# 42077) for Remove Consecutive Duplicate Lines.

              I was so close too but made a sacrifice to the dev time bandit for curiosity’s sake (and perhaps a touch of my OCD)…

              Does anyone have suggestions on how to accomplish this?

              Thanks in advance

              E 1 Reply Last reply Jun 29, 2019, 3:36 AM Reply Quote 0
              • E
                eltrkbrd @eltrkbrd
                last edited by eltrkbrd Jun 29, 2019, 3:39 AM Jun 29, 2019, 3:36 AM

                @Alan-Kilborn
                Note, ID mapped out to Ctrl + Shift + A. I edited shortcut.xml and changed the ID to 42077 from 42059 as found in https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/nativeLang/english.xml

                shorcut.xml

                1 Reply Last reply Reply Quote 1
                • E
                  eltrkbrd
                  last edited by Jun 30, 2019, 3:04 PM

                  Shortcut mapper bug still unresolved; however, as a work around I found the NppMenuSearch plugin to be very useful.

                  For those interested, it can be downloaded here:
                  https://github.com/peter-frentrup/NppMenuSearch

                  It’s a single click workaround but unfortunately doesn’t solve the problem with mapping a keyboard shortcut to the remove duplicate lines internal command.

                  Any ideas?

                  A 1 Reply Last reply Jun 30, 2019, 8:11 PM Reply Quote 0
                  • A
                    Alan Kilborn @eltrkbrd
                    last edited by Alan Kilborn Jun 30, 2019, 8:13 PM Jun 30, 2019, 8:11 PM

                    @eltrkbrd

                    Using Notepad++ 7.7.1 I was able to custom-add a macro to my shortcuts.xml like so:

                        <Macro name="test" Ctrl="no" Alt="no" Shift="no" Key="0">
                            <Action type="2" message="0" wParam="42077" lParam="0" sParam="" />
                        </Macro>
                    

                    I didn’t bind it to a keycombo, but when I ran it from the Macro menu, it worked just fine to delete the consecutive duplicate lines. Thus, it should have no problem when given a keycombo and then run from that keycombo.

                    I see that you defined your try at it a bit differently–why don’t you give my way a try? Note: Be sure to put it in the Macros section.

                    M 1 Reply Last reply Jun 2, 2020, 9:38 AM Reply Quote 3
                    • M
                      MK Digital @Alan Kilborn
                      last edited by Jun 2, 2020, 9:38 AM

                      @Alan-Kilborn Just to clarify my error was that shortcuts.xml is in the program folder, but the one that needs editing is the in windows is the user App Data Drive:/Users/username/AppData/Roaming/Notepad++

                      Taking your suggestion though, I just recorded a macro using the recorder and that worked perfect. The second line was the action mentioned.

                          <Macro name="Sort and Delete" Ctrl="no" Alt="no" Shift="yes" Key="112">
                              <Action type="2" message="0" wParam="42059" lParam="0" sParam="" />
                              <Action type="2" message="0" wParam="42077" lParam="0" sParam="" />
                          </Macro>
                      

                      Just if anyone runs into the same difficulty, as this command I could not find to map. Thanks to @Alan-Kilborn for the solution.

                      E 1 Reply Last reply Jun 2, 2020, 7:09 PM Reply Quote 2
                      • E
                        Ekopalypse @MK Digital
                        last edited by Jun 2, 2020, 7:09 PM

                        @MK-Digital
                        Whether it is in appdata or not depends on how you installed npp and
                        whether you are using the doLocalConf.xml or not.

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