Notepad++: Adding a new shortcut for an existing command

后端 未结 1 1061
一个人的身影
一个人的身影 2020-12-17 07:42

I want to make \"Ctrl+G\" to open the find dialogue, just as Ctrl+F\" (so both shortcuts open the same \"find dialogue\").

I know I can modify the existing shortcuts

相关标签:
1条回答
  • 2020-12-17 08:00

    Here is how you can add a second keybinding to the find dialog. Notepad++ does not offers this out of the box. We can only assign one keybinding.
    We need a way to add a second find dialog. One way I can think of is by the very useful npp_exec plugin. It offers to create small automation-scripts and we can add these scripts to the menu. It also offers a (little hidden) way for assigning shortcuts for these scripts.

    So the strategy is:

    1. install npp_exec, you find it in the plugin manager and restart notepad++
    2. create a npp_exec script with this content: NPP_SENDMSG WM_COMMAND IDM_SEARCH_FIND, save it, e.g. as OpenFindDlg, you create such a script by Plugins -> NppExec -> Execute..., enter the script and click Save...
    3. Go to Plugins -> NppExec -> Advanced Options ...
      1. Select OpenFindDlg under Associated script
      2. give it a menu entry under Item name: e.g, OpenFindDlg
      3. Click Add/Modify, you want to get a new entry in the list area on the left, see screenshot:
    4. restart Notepad++, so get this setting activated.
    5. add the additional shortcut: goto Settings -> Shortcut mapper: somewhere under the Plugins tab, you will find the Name that you have saved the script, here OpenFindDlg. Now you can assign your shortcut CTRL-G.
      Take care that you have also deleted the existing keybinding CTRL-G for the goto line command somewhere under the Main menu Tab.
    0 讨论(0)
提交回复
热议问题