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

隐身守侯 提交于 2019-12-01 00:53:19

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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!