Disabling all Np++ keyboard shortcuts?



  • @Alan-Kilborn

    In the end it wasn’t that complicated.
    Created the node with

    from Npp import notepad, editor, MENUCOMMAND
    
    npp_template = '        <Shortcut id="{0}" Ctrl="no" Alt="no" Shift="no" Key="" />\r\n'
    sci_template = '        <ScintKey ScintID="{}" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="0" />\r\n'
    nodes = ''
    
    
    for key in sorted(MENUCOMMAND.values.keys()):
        nodes += npp_template.format(key)
    
    for key in range(2000, 3000):
        nodes += sci_template.format(key)
    
    notepad.new()
    editor.setText(nodes)
    

    and pasted it into the respective tag in shortcuts.xml.
    Started npp and checked shortcut mapper. A few were left.
    Edited it manually and closed npp.
    Resulted in this



  • @Ekopalypse said in Disabling all Np++ keyboard shortcuts?:

    checked shortcut mapper. A few were left.

    Does this mean that these few weren’t represented in the Pythonscript MENUCOMMAND’s ?
    Wouldn’t those be bugs (of omission) in Pythonscript code?

    I noticed that the Search menu’s Mark command is missing.
    For a long time I thought it was truly missing, but then I realized that it is just missing from the documentation.
    I guess that is a (documentation) bug.
    Of course, maybe corrected now as I’m running an older PS.



  • @Alan-Kilborn said in Disabling all Np++ keyboard shortcuts?:

    Does this mean that these few weren’t represented in the Pythonscript MENUCOMMAND’s ?

    To be honest, I haven’t checked this. Maybe I will check this some time.



  • @Alan-Kilborn

    These are the remaining ones.
    I wouldn’t say that they are missing in the MENUCOMMAND class.
    Those from Scintilla have an association with menucommand id, so they are not covered by the script at all.
    about and run… are not really helpful for scripting.
    toggle macro record not sure where this comes from!?
    The shortcut mapper claims that this is in the Edit menu,
    as are the other two, but I can’t find them.
    I assume switch to previous/next document are from the document switcher.

    NPP
    switch to previous document     <Shortcut id="50003" Ctrl="no" Alt="no" Shift="no" Key="0" />
    switch to next document         <Shortcut id="50004" Ctrl="no" Alt="no" Shift="no" Key="0" />
    toggle macro record             <Shortcut id="50005" Ctrl="no" Alt="no" Shift="no" Key="0" />
    run ...                         <Shortcut id="49000" Ctrl="no" Alt="no" Shift="no" Key="0" />
    about                           <Shortcut id="47000" Ctrl="no" Alt="no" Shift="no" Key="0" />
    
    SCINTILLA
    SCI_CUT                         <ScintKey ScintID="2177" menuCmdID="42001" Ctrl="no" Alt="no" Shift="yes" Key="0" />
    SCI_COPY                        <ScintKey ScintID="2178" menuCmdID="42002" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    SCI_PASTE                       <ScintKey ScintID="2179" menuCmdID="42005" Ctrl="no" Alt="no" Shift="yes" Key="0" />
    SCI_SELECTALL                   <ScintKey ScintID="2013" menuCmdID="42007" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    SCI_CLEAR                       <ScintKey ScintID="2180" menuCmdID="42006" Ctrl="no" Alt="no" Shift="no" Key="0" />
    SCI_UNDO                        <ScintKey ScintID="2176" menuCmdID="42003" Ctrl="no" Alt="yes" Shift="no" Key="0" />
    SCI_REDO                        <ScintKey ScintID="2011" menuCmdID="42004" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    SCI_TAB                         <ScintKey ScintID="2327" menuCmdID="42008" Ctrl="no" Alt="no" Shift="no" Key="0" />
    SCI_BACKTAB                     <ScintKey ScintID="2328" menuCmdID="42009" Ctrl="no" Alt="no" Shift="yes" Key="0" />
    SCI_ZOOMIN                      <ScintKey ScintID="2333" menuCmdID="44023" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    SCI_ZOOMOUT                     <ScintKey ScintID="2334" menuCmdID="44024" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    SCI_SETZOOM                     <ScintKey ScintID="2373" menuCmdID="44033" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    SCI_SELECTIONDUPLICATE          <ScintKey ScintID="2469" menuCmdID="42010" Ctrl="yes" Alt="no" Shift="no" Key="0" />
    


  • @Ekopalypse

    In your definition of npp_template, how come Key="" rather than Key="0"?

    And for Scintilla, is there really 1000? Or is there just no good way to tell what is really used?



  • @Alan-Kilborn

    Was working - so I ignored it, I guess. :-D



  • @Alan-Kilborn said in Disabling all Np++ keyboard shortcuts?:

    And for Scintilla, is there really 1000? Or is there just no good way to tell what is really used?

    As a rough estimate, most of the 1000 are used. Scintilla.iface uses the first 3000 or so lines for the main Scintilla messages, at about 3 lines per message, so approximately 1000.

    Or, even closer: when I auto-generated Win32::Mechanize::NotepadPlusPlus::Editor::Messages from the Scintilla.h file, I got about 700 entries in my %SCIMSG hash. It should be noted that I see most messages from 2000-2723 (with some holes), 3000-3002, and 4000-4032, so clearing 2000-3000 isn’t technically the way to get them all.



  • @Alan-Kilborn

    hmm - didn’t see the second part.

    My trigger was based on the header file

    #define SCI_START 2000
    #define SCI_OPTIONAL_START 3000
    #define SCI_LEXER_START 4000
    

    and as @PeterJones already stated, it seems there is no runtime method to find out which id is the last one, at least I don’t know.



  • Hi, @ekopalypse and All,

    From your specific shortcuts.xml, which disables all possible default N++ shortcuts, I deduced two things :

    • A few shortcuts, relative to the About section, present in the Shortcut Mapper, are missing in your file :
    •---------•--------------------------------------------------------------------------------•
    | ID_NUM  |                            N++ Command ( + Notes )                             |
    •---------•--------------------------------------------------------------------------------•
    |  47010  |  ? > Command Line Arguments...                                                 |
    |  47011  |  ? > Live Support   ( https://gitter.im/notepad-plus-plus/notepad-plus-plus )  |
    |  47009  |  ? > Set Updater Proxy...                                                      |
    |  47012  |  ? > Debug Info...                                                             |
    •---------•--------------------------------------------------------------------------------•
    

    • I also identified some N++ commands, in the list below, NOT present in the Shortcut Mapper, which can be used in a macro !

    For each command needed, add, for instance, these 3 lines in the Macros node of shortcuts.xml

    • Changing its name and, possibly defining a shortcut, if desired, in the first line

    • Inserting the right ID_NUM number in the second line

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

    I suppose, @ekopalypse, that these following commands do not need to be added in your specific shortcut file, as not considered as shortcut-assigned commands, by the Shortcut Mapper ?

    •---------•--------------------------------------------------------------------------------------------------------------------------•
    | ID_NUM  |                                                 N++ Command ( + Notes )                                                  |
    •---------•--------------------------------------------------------------------------------------------------------------------------•
    |  42010  |  Edit > Line Op. > Duplicate Current Line ( IDM_EDIT_DUP_LINE )   idem Scintilla command SCI_LINEDUPLICATE
    |         |                                                                   Different from SCI_SELECTIONDUPLICATE ( Ctrl + D ) !
    |  42040  |  File > Open All Recent Files
    |  42041  |  File > Empty Recent Files List
    |         |
    |  42037  |  Edit > Column Mode...
    |  42077  |  Edit > Line Operations > Remove Consecutive Duplicate Lines
    |         |
    |  43101  |  System Tray > Activate
    |  43102  |  System Tray > New                 
    |  43103  |  System Tray > New and Paste       
    |  43104  |  System Tray > Open...             
    |  43105  |  System Tray > Close Tray Icon
    |  ?????  |  System Tray > Find in Files...  ( Not Found )
    |         |
    |  45063  |  Encoding > Character Set > Korean > Windows-949
    |         |
    |  46002  |  Language > C > C
    |  46003  |  Language > C > C++
    |  46004  |  Language > J > Java
    |  46005  |  Language > H > HTML
    |  46006  |  Language > XML
    |  46007  |  Language > J > JavaScript
    |  46008  |  Language > P > PHP
    |  46009  |  Language > A > ASP
    |  46010  |  Language > C > CSS
    |  46011  |  Language > P > Pascal
    |  46012  |  Language > P > Python
    |  46013  |  Language > P > Perl
    |  46014  |  Language > O > Objective-C
    |  46015  |  Language > M > MS-DOS Style
    |  46016  |  Language > N > Normal Text
    |  46017  |  Language > R > Resource file
    |  46018  |  Language > M > Makefile
    |  46019  |  Language > I > INI file
    |  46020  |  Language > S > SQL
    |  46021  |  Language > V > Visual Basic
    |  46022  |  Language > B > Batch
    |  46023  |  Language > C > C#
    |  46024  |  Language > L > Lua
    |  46025  |  Language > T > TeX
    |  46026  |  Language > F > Fortran (free form)
    |  46027  |  Language > S > Shell
    |  46028  |  Language > A > ActionScript
    |  46029  |  Language > N > NSIS
    |  46030  |  Language > T > TCL
    |  46031  |  Language > L > LISP
    |  46032  |  Language > S > Scheme
    |  46033  |  Language > A > Assembly
    |  46034  |  Language > D > Diff
    |  46035  |  Language > P > Properties
    |  46036  |  Language > P > PostScript
    |  46037  |  Language > R > Ruby
    |  46038  |  Language > S > Smalltalk
    |  46039  |  Language > V > VHDL
    |  46040  |  Language > C > Caml
    |  46041  |  Language > KIXtart
    |  46042  |  Language > A > Ada
    |  46043  |  Language > V > Verilog
    |  46044  |  Language > A > AutoIt
    |  46045  |  Language > M > Matlab
    |  46046  |  Language > H > Haskell
    |  46047  |  Language > I > Inno Setup
    |  46048  |  Language > C > CMake
    |  46049  |  Language > YAML
    |  46050  |  Language > C > COBOL
    |  46051  |  Language > D > D
    |  46052  |  Language > Gui4Cli
    |  46053  |  Language > P > PowerShell
    |  46054  |  Language > R > R
    |  46055  |  Language > J > JSP
    |  46056  |  Language > C > CoffeeScript
    |  46057  |  Language > J > JSON
    |  46058  |  Language > F > Fortran (fixed form)
    |  46059  |  Language > B > BaanC
    |  46060  |  Language > S > S-Record
    |  46061  |  Language > I > Intel HEX
    |  46062  |  Language > T > Tektronix extended HEX
    |  46063  |  Language > S > Swift
    |  46064  |  Language > A > ASN.1
    |  46065  |  Language > A > AviSynth
    |  46066  |  Language > B > Blitzbasic
    |  46067  |  Language > P > Purebasic
    |  46069  |  Language > C > CSound
    |  46070  |  Language > E > Erlang
    |  46071  |  Language > E > ESCRIPT
    |  46072  |  Language > F > Forth
    |  46073  |  Language > L > LaTex
    |  46074  |  Language > M > MMIXAL
    |  46075  |  Language > N > Nncrontab
    |  46076  |  Language > N > Nimrod
    |  46077  |  Language > O > OScript
    |  46078  |  Language > R > REBOL
    |  46079  |  Language > R > Registry
    |  46081  |  Language > S > Spice
    |  46082  |  Language > t > txt2tags
    |  46083  |  Language > V > Visual Prolog
    |         |
    |  47003  |  ? > Online Documentation   ( https://npp-user-manual.org/ )
    |         |
    |  48014  |  Plugins > Open Plugins Folder..
    |  48015  |  Plugins > Plugins Admin...
    |         |
    |  48016  |  Macro > Modify Shortcut/Delete Macro...
    |         |
    |  48017  |  Run > Modify Shortcut/Delete Command...
    |         |
    |  48501  |  Tools > MD5 > Generate...
    |  48502  |  Tools > MD5 > Generate from files...
    |  48503  |  Tools > MD5 > Generate from selection into clipboard
    |         |
    |  48504  |  Tools > SHA-256 > Generate...
    |  48505  |  Tools > SHA-256 > Generate from files...
    |  48506  |  Tools > SHA-256 > Generate from selection into clipboard
    |         |
    |  44002  |  Settings > Preferences... > General > Toolbar > Small Icons
    |  44003  |  Settings > Preferences... > General > Toolbar > Big Icons
    |  44004  |  Settings > Preferences... > General > Toolbar > Standard Icons
    |         |
    |  44070  |  Settings > Preferences... > General > Document List Panel > Show
    |  43501  |  Contextual Menu of Doc Switcher  > Close [ Selected files ]
    |  43502  |  Contextual Menu of Doc Switcher  > Close All But This
    |         |
    |  44044  |  Settings > Preferences... > General > Tab Bar > Multi-line
    |  44043  |  Settings > Preferences... > General > Tab Bar > Vertical
    |  44005  |  Settings > Preferences... > General > Tab Bar > Reduce
    |  44006  |  Settings > Preferences... > General > Tab Bar > Lock (no drag and drop)
    |  44008  |  Settings > Preferences... > General > Tab Bar > Darken inactive tabs
    |  44007  |  Settings > Preferences... > General > Tab Bar > Draw a colored bar on active tab
    |  44038  |  Settings > Preferences... > General > Tab Bar > Show close button on each tab
    |  44039  |  Settings > Preferences... > General > Tab Bar > Double click to close document
    |         |
    |  44015  |  Settings > Preferences... > Editing > Folder Margin Style > Simple
    |  44016  |  Settings > Preferences... > Editing > Folder Margin Style > Arrow
    |  44017  |  Settings > Preferences... > Editing > Folder Margin Style > Circle tree
    |  44018  |  Settings > Preferences... > Editing > Folder Margin Style > Box tree
    |  44014  |  Settings > Preferences... > Editing > Folder Margin Style > None
    |         |
    |  44037  |  Settings > Preferences... > Editing > Vertical Edge Settings > None              ( Up to N++ 7.8.5 )
    |  44027  |  Settings > Preferences... > Editing > Vertical Edge Settings > Line Mode         ( Up to N++ 7.8.5 )
    |  44028  |  Settings > Preferences... > Editing > Vertical Edge Settings > Background mode   ( Up to N++ 7.8.5 )
    |         |
    |  44046  |  Settings > Preferences... > Editing > Line Wrap > Default
    |  44047  |  Settings > Preferences... > Editing > Line Wrap > Aligned
    |  44048  |  Settings > Preferences... > Editing > Line Wrap > Indent
    |         |
    |  44012  |  Settings > Preferences... > Editing > Display line number
    |  44013  |  Settings > Preferences... > Editing > Display bookmark
    |  44021  |  Settings > Preferences... > Editing > Display current line highlighting
    •---------•--------------------------------------------------------------------------------------------------------•
    

    Best Regards,

    guy038



  • @guy038 said in Disabling all Np++ keyboard shortcuts?:

    42077 | Edit > Line Operations > Remove Consecutive Duplicate Lines

    Regarding that one, see https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8546


  • Banned

    Hello,@I-neuw

    Please follow this step,To disabling all Np++ keyboard shortcuts.

    Step 1:-Settings -> Shortcut Mapper
    Step 2:-Select the key binding you want to modify, for example some Scintilla command.
    Step 3:-Click Modify.
    Step 4:-The Remove box is grayed out, that’s fine. Untick all the check boxes (CTRL/ALT/SHIFT)
    Step 5:-Choose the first option “None” in the drop down menu for the key combo.
    Step 6:-Click "Apply"

    I hope this information wil be useful.
    Thank you.



  • @Makwana-Prahlad

    OP asked:

    Is there a way I can disable all NP++ shortcuts en masse, not just one by one?

    You described how to do it one-by-one.
    Clearly, not what was wanted.
    Why was it not clear to you?



  • @guy038 - thx for sharing, not sure why I’ve missed those.


Log in to reply