Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Issues with Shortcuts

2013-04-14
2013-04-16
  • David Bailey
    David Bailey
    2013-04-14

    Shortcuts are great, and they make it very easy to access plugin functionality, however, I do find it inconvenient that one shortcut can invisibly hide another - particularly if I experiment with different plugins.

    It would be really nice if I could obtain a simple textual "shortcut status" file that contained all the information in the Shortcut Mapper, but in a form that would let me edit it (on a read only basis) to search for every use of Ctrl-Shift-S or whatever.

    Alternatively (but more work) would be a feature that analysed all shortcuts looking for duplicate use, and possible a feature to test a possible shortcut to see if it is in use.

    As usual, I may have missed an existing way to solve this!

    David

     
  • THEVENOT Guy
    THEVENOT Guy
    2013-04-14

    Hi, David,

    As far as I'm concerned, I created an .XLS file, where I sum up ALL the
    original shortcuts, as well as the creation of new shorcuts and the deletion
    of the pre-existant shortcuts, that I made.

    Thus, it's easy to filter that list ( option "automatic filtering of EXCEL )
    with ANY criterion you like, to get ANY possible search ! ( for example :
    What are ALL the ALT + SHIFT shortcuts used ? or : What ALL the shortcuts
    relative to the letter U ?, and so on...)

    Pratically, I use an eight columns list, with :

    • the name of the menu or plugin command
    • the order's number in the shortcut mapper
    • the name of the command
    • the use of the combined ALT key ( Y/N )
    • the use of the combined CTRL key ( Y/N )
    • the use of the combined SHIFT key (Y/N)
    • the name of the key ( main keyboard or numeric keyboard )
    • the state of the shortcut ( Nothing if NOT changed, Old or new)

    Note : If I changed or deleted a shortcut, I write TWO lines :

    • one, relative to the old configuration, with state = O
    • one, relative to the new configuration, with state = N

    So, I'm not afraid of using duplicate shortcuts !

    Of course, your need to update this .xls file, every time you do something about shortcuts !

    But, I do agree with you, that the shortcut mapper may be improved !


    To Don Ho,

    By the way, from the version 5.8.7 of N++, the new elements
    of menus, below, are NOT integrated to the Shortcut Mapper !

    • Edit\Line Operations\Remove Empty Lines

    • Edit\Line Operations\Remove Empty Lines ( Containing Blank characters)

    • Edit\Comment/Uncomment\Stream Uncomment

    • Edit\Paste Special\Paste HTML Content

    • Edit\Paste Special\Paste RTF Content

    • Edit\Paste Special\Copy Binary Content

    • Edit\Paste Special\Cut Binary Content

    • Edit\Paste Special\Paste Binary Content

    • Edit\Character Panel

    • Edit\Clipboard History

    • Search\Bookmark\Remove Unmarked Lines

    • Search\Bookmark\Inverse Bookmark

    • View\Summary...

    • View\Project\Project Panel 1

    • View\Project\Project Panel 2

    • View\Project\Project Panel 3

    • View\Document Map

    • Settings\Import\Import plugin(s)...

    • Settings\Import\Import style theme(s)...

    • Settings\Edit Popup ContextMenu

    • Modify Shortcut/Delete Macro...

    • Modify Shortcut/Delete Command...

    Note : I'm not sure it's possible for the last two items, because they open the "Shortcut Mapper" ! )

    So, if we like a shortcut for one of the actions above, we need to use macros or to configure the contextual menu :( !

    Don Ho, is just there an oversight or is there a pertinent cause to these omissions ?

    Best regards,

    guy038

     
    Last edit: THEVENOT Guy 2013-04-14
  • ArchCarrier
    ArchCarrier
    2013-04-14

    +1 to improve the shortcut mapper. In addition to the suggestions made in the previous posts, I'd like to see headers in the 'Plugin commands' page, so that it's easy to see which commands belong to which plugin.

     
  • David Bailey
    David Bailey
    2013-04-15

    I tried reassigning a plugin shortcut with the shortcut mapper, and then looking for an XML file that had changed, but I couldn't find one. There is a file shortcuts.xml in a nice easy format, but it only seems to relate to a few shortcuts.

    I also tried a grep for the string "shift=" in the XML files, but that only showed up the shortcuts.xml file. I am wondering where all the other shortcut information is stored - I mean the pludin DLL's contain the default mapping for each action, but obviously they don't get updated, and I was under the impression that NP++ doesn't store information in the registry.

    David

     
  • THEVENOT Guy
    THEVENOT Guy
    2013-04-16

    Hello David,

    The different shortcuts, used by Notepad++, are, normaly, saved in the file
    "shortcuts.xml".

    But, this file may be store in two differents places !

    • If the zero length control file "doLocalConf.xml" is present,
      in the Notepad++ directory, it's the local "shortcuts.xml", which is used by N++.

    ( This is the case of an N++'s installation with a 7z or .zip archive )

    • If the zero length control file "doLocalConf.xml" is not present,
      in the Notepad++ directory, the localization of the right "shortcuts.xml" file is :

    %AppData%\Notepad++, where the system variable %AppData% is :

    <Drive Letter>\Documents and Settings\<User Name>\Application Data

    ( This is the case of an N++'s installation with the Installer )

    Important :

    Generally, the "Applicata Data" folder is hidden and protected by Windows.
    So, you need to allow your explorer to display that kind of folder and you need to get permissions to modify it !

    Notes :

    The "shortcuts.sml" file contains ALL the shortcuts of, in order :

    • Internal commands
    • Macros
    • UserDefined commands
    • Plugins commands
    • Scintilla keys

    In this file, for each shortcut, there's a parameter : Key="<Scan Code>"
    where <Scan Code> is a one, two or a three digits number

    If you give me an e-mail address, I will send you a small .xls file,
    in compatibility mode ( Excel 97-2003), which contains the different
    scan codes
    , used by Notepad++.

    Two points :

    • I'm French and work with a french keyboard ( of course! ) So, for few keys,
      you'll need to find out the scan code by yourself !

    • This list is almost exhaustive ! ( I just can't find out the right key,
      on my french keyboard, for the scan code 189 !! and the scan code 223,
      although not listed in the shorcuts Manager of N++, is sent if I press
      the "§!" key, on my french keyboard !

    I hope my explanations will be useful to you !

    Best regards,

    guy038

     
    Last edit: THEVENOT Guy 2013-04-16
  • David Bailey
    David Bailey
    2013-04-16

    I find I have Shortcut.xml files in both locations, but neither contains anything like the total collection of shortcuts - both are less than 30 lines long!

    David

     
  • THEVENOT Guy
    THEVENOT Guy
    2013-04-16

    Hi David,

    I think I understood what you meant about the "Shortcuts.xml" file !

    On a fresh dezipped 6.3.1 version of N++, the local file "shortcuts.xml" looks like below :

    <NotepadPlus>
        <InternalCommands />
        <Macros>
            <Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
                <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
                <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
            </Macro>
        </Macros>
        <UserDefinedCommands>
            <Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command>
            <Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">iexplore &quot;$(FULL_CURRENT_PATH)&quot;</Command>
            <Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">chrome &quot;$(FULL_CURRENT_PATH)&quot;</Command>
            <Command name="Launch in Safari" Ctrl="yes" Alt="yes" Shift="yes" Key="70">safari &quot;$(FULL_CURRENT_PATH)&quot;</Command>
            <Command name="Get php help" Ctrl="no" Alt="yes" Shift="no" Key="112">http://www.php.net/%20$(CURRENT_WORD)</Command>
            <Command name="Google Search" Ctrl="no" Alt="yes" Shift="no" Key="113">http://www.google.com/search?q=$(CURRENT_WORD)</Command>
            <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">http://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
            <Command name="Open file" Ctrl="no" Alt="yes" Shift="no" Key="116">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD)</Command>
            <Command name="Open in another instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession -multiInst</Command>
            <Command name="Open containing folder" Ctrl="no" Alt="no" Shift="no" Key="0">explorer $(CURRENT_DIRECTORY)</Command>
            <Command name="Open current dir cmd" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /K cd /d $(CURRENT_DIRECTORY)</Command>
            <Command name="Send via Outlook" Ctrl="yes" Alt="yes" Shift="yes" Key="79">outlook /a &quot;$(FULL_CURRENT_PATH)&quot;</Command>
        </UserDefinedCommands>
        <PluginCommands />
        <ScintillaKeys />
    </NotepadPlus>
    

    So, like you said, it's obvious that this file doesn't display default N++'s shortcuts,
    default Scintilla's shorcuts and default plugins's shortcuts.

    And, like you, I don't know in which part of "notepad.exe", these different default
    shortcuts
    are stored !

    As you can see, by default, the file "shortcuts.xml" store only user shortcuts
    ( "Macros" and "UserDefinedCommands" )

    But, let suppose :

    • You create a new shortcut, relative, for example, to "Settings\Preferences...",
      and affect the shortcut, let say, CTRL + ALT + P to this N++ command, with the
      "Shortcut Mapper..." : Tab "Main menu" then double-click on line 184,
      set the "CTRL" and "ALT" boxes and choose the letter "P", in the list.

    • You modify an existant shortcut, relative, for example, to "File\Exit",
      and affect the shortcut, let say, ALT + X to this N++ command, with the
      "Shortcut Mapper..." : Tab "Main menu" then double-click on line 17,
      set the "ALT" box and choose the letter "X", in the list.

    • You delete an existant shortcut, for example CTRL + F, to the command "Find...",
      with the "Shortcut Mapper..." : Tab "Main menu" then double-click on line 47 "Find..." and choose "None", instead of the letter F, at the beginning of the list.

    => ALL these actions will be added in the file "shortcuts.xml", on Notepad++'s exit !

    As they all concern N++, these 3 new user shortcuts are all merged in the "InternalCommands" section of "Shortcuts.xml", which looks, now, like below :

     <InternalCommands>
        <Shortcut id="48011" Ctrl="yes" Alt="yes" Shift="no" Key="80" />
        <Shortcut id="43001" Ctrl="no" Alt="no" Shift="no" Key="0" />
        <Shortcut id="41011" Ctrl="no" Alt="yes" Shift="no" Key="88" />
    </InternalCommands>
    

    Note the scan code 0, meaning no shortcut, to

    override the defaut shortcut of the "Find..." command. The id number ( 43001 ) can be found, in Source archive, in the file "MenuCmdID.h"".

    Of course, IF, with an other editor ( Microsoft Notepad, Wordpad,... ), you delete these 3 definitions, in the file "Shortcuts.xml", and go back to the original line :

    <InternalCommands />
    

    You'll find, again, the 3 default shortcuts, on N++'s opening ! In other words :

    CTRL + F for the "Search\Find..." command
    ALT + F4 for the "File\Exit" command
    NO shortcut for the "Settings\Preferences" command

    Cheers,

    guy038

     
    Last edit: THEVENOT Guy 2013-04-16