Remove Consecutive Duplicate Lines - How to add in Shortcut mapper?
-
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.
-
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
-
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… -
It seems as if you are well on your way to a solution for yourself.
-
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
-
@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 -
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/NppMenuSearchIt’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?
-
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. -
@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 DataDrive:/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.
-
@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.