问题
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 of commands through "macro > modify shortcut", but it allows changing the shortcut only, not the "Name" of the command (shaded).
回答1:
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:
- install npp_exec, you find it in the plugin manager and restart notepad++
- 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... - Go to Plugins -> NppExec -> Advanced Options ...
- Select OpenFindDlg under Associated script
- give it a menu entry under Item name: e.g, OpenFindDlg
- Click Add/Modify, you want to get a new entry in the list area on the left, see screenshot:
- restart Notepad++, so get this setting activated.
- 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 keybindingCTRL-G
for the goto line command somewhere under the Main menu Tab.
来源:https://stackoverflow.com/questions/34609009/notepad-adding-a-new-shortcut-for-an-existing-command