Disable menu activation for a shortcut.



  • Hello Notepad++ folks,

    How do I unmap or otherwise prevent a shortcut from activating a menu?

    For example, I mapped Alt-L to delete line. My shortcut works (line is deleted), but also activates the “Language” menu, which I do not want.

    Thanks in advance for the help.



  • Hello, @steve-king,

    Ah, yes, the Alt + Letter shortcuts are, usually, associated with the some choices of the menu bar !

    To change these default shortcuts :

    • Close any instance of Notepad++

    • Localize the english_customizable.xml file, in the localization folder, under :

      • The installation folder of Notepad++.exe, for a local installation, with the zero-length file doLocalConf.xml

      • The folder %AppData%\Roaming\Notepad++, in case of installation, with the installer, on a W7, W8 or W10 machine

      • The folder %AppData%\Notepad++, in case of installation, with the installer, on a Win XP or Vista machine

    • At beginning of that file, in the <Entries> section, change the line :

    <Item menuId="language" name="&amp;Language"/>
    

    by, for instance, this one :

    <Item menuId="language" name="Lan&amp;guage"/>
    
    • Save the changes of english_customizable.xml file

    • Re-start Notepad++

    • Choice the option Settings > Preferences... > General > Localization

    • Select the language English (customizable)

    • Click on the Close button

    => From now on, you’ll have to hit the shortcut Alt + G, to select the Language menu ! … and no more conflict with your Alt + L shortcut :-D

    Best Regards,

    guy038



  • @guy038 ,

    Very nice–I didn’t know these type of key combinations could be reassigned, or even REMOVED entirely (just delete the “&” part completely instead of moving it to another selection of the menu word). But it makes sense as you could change the File menu text to say “Panda” (or whatever) if you wanted, and there is no “F” in that!

    One thing I did try was to NOT close and restart Notepad++…and it works just fine this way. Even though I already had “English (customizable)” selected in the dropdown in the Preferences, all I had to do was drop down the menu like I was going to change AWAY from “English (customizable)”, but then actually just reselect it. After that any changes made to the english_customizable.xml file take effect.



  • @Scott-Sumner

    Oops. It appears that if you remove &amp; entirely from the text of a menu item, the original Alt-based keycombo will still work (Alt+F in the case of File, Alt+L in the case of Language, etc), even though there will be no underline of that letter when the “File Edit Search…” menu is activated by pressing and releasing Alt alone. :(

    In the earlier post, where I said & it should have been &amp; I didn’t check the markdown. :(



  • I also removed the &amp; completely, and trying to diagnose why I still saw default behavior was driving me crazy. I ended up just adding &amp;_ to the end of each menu item.


Log in to reply