Right Click >> Find All in Current Document
-
You are in charge of the right-click menu; just edit the XML file. Unfortunately, you cannot add commands that are tied to dialog box buttons (like Find All in Current Document or Find All in All Opened Documents). You can only add commands that appear on the NPP menus, I believe.
Now, if @Don-HO or some other enterprising programmer out there would add Find All in Current Document and Find All in All Opened Documents to NPP’s Search menu, then we’d be able to add them to our context menus.
-
I’m trying to get my head around this…not necessarily the money part. :)
I can invoke the Find dialog with one shortcut keycombo; it will grab the word at the caret or whatever is currently selected for the default find text. Then with one more keycombo (alt plus something) I can make it do the “Find all in current doc”. The Find dialog box window will then close and the search will be completed. That is basically TWO actions (KEYs).
You want to trade those two actions for THREE MOUSE actions: a right-click to invoke the context menu, mouse movement to find your context menu item, and finally a left-click to select it.
I don’t see what you’d gain with such a plugin, but you’re allowed to prefer whatever you’d like. :-)
-
@Scott-Sumner127
I have thought of this before but unfortunately the second part of your answer is not actually available as the (alt plus something) does not exist for “current document” but only “all documents”. So I’m either looking for a full keyboard solution or a shorter full mouse solution.
The other reason this is important to me is that I live in both Visual Studio and np++ for 8 hours a day and my muscle memory would like similar functions in both. I just happen to right click “find all reference” in VS a many times per day and I just miss this route in np++.
-
I guess the “Find all in current doc” button doesn’t have an Alt+something keycombo BY DEFAULT. [However, I tested it before suggesting it earlier, so read on… :-)… ]
But the good news is that you can add one! See here for the general technique : https://notepad-plus-plus.org/community/topic/11041/new-alt-shortcuts-in-the-find-dialog-for-default-english-language There’s a lot of info in that posting to sift through, but it is all good stuff thanks to @guy038 .
Hopefully that gives you a suitable “all-keyboard” solution.
If you are familiar with the Pythonscript plugin, it may also be possible to do something with a bit of Python code calling the SendKeys module to do the keystroking, possibly with some small timer delays inserted. Invoking the script could be tied into the right-click context menu, giving you your all-mouse solution. Pythonscript may be more than you’d want to get involved in if you’re not already familiar, and I’m not certain it would work end-to-end because I haven’t tried it, but…in theory…
Perhaps AutoIt or AutoHotKey could be used to good effect as well, but again, I’m not sure to what lengths you want to go…clearly you wanted to go into the 100USD range, though, so I’m guessing these things I’m suggesting aren’t out of the realm of possibility for you.
-
Jim, I like your idea, but like many other find-related desires (e.g. @guy038 's recent "status-bar Find indicators), it opens up the door to more things, for example, as soon as you have the ability to start a search in the manner you suggest, people will want/need a way to control all of the other Find parameters in a similar way. Not that this is a bad thing…
It reminds me of my own desire to have a way to specify text dynamically to a macro-based Find. Sure, there is an extra syntax built onto the macro mechanism to run allow one to run hard-coded (into the macro text) finds, and that’s valuable, but only in a limited sense. Opening that up to even just selected text or the word at the caret being grabbed as the find text would magnify the value of the feature. But now I’m off topic…
-
Thanks Scott.
I just made the modifications to the XML and the keyboard command works well. I will use that moving forward but the offer still stands that if someone wants to write the plug in I am more that willing to throw cash at it as I don’t currently have the time to learn/write the plugin. Some times my mind approaches an action from a keyboard point of view and other times my mind approaches an action from the mouse point of view. I know I switch between Ctrl+C and right clicking copy all the time.
Thanks for everyone’s suggestions and help.
-
Okay…so I don’t like doing it, but I can admit it when I’m wrong. And I’m wrong. :-)
I implemented an all-mouse AutoIt3-based solution to this idea, and, much to my surprise, I find it very useful and more convenient than the all-keyboard solution.
Here’s my AutoIt code from my .au3 file:
#include <Constants.au3> Local $find_all_curr_doc_CNTRL_ID = 1641 Send("^f") ; invoke N++'s find dialog box window with ctrl+f Sleep(50) ; may need a delay upon first invocation in a Notepad++ session? ControlClick("Find", "", $find_all_curr_doc_CNTRL_ID)
Invoking it is set up through the Run menu, and after that is set it can be added to the right-click context menu. It works as the original poster intended–right-click the desired word (or highlight a selection and right-click that), then choose the new context-menu item…and BAM!..the Find Results panel now contains the results of a Find All In Current Document search.
-
Just got done implementing your autoit solution. Works great. Was able to put it right at the top of my context menu. Thanks for taking the time to prove it out and updating the thread. Now I might put together a little installer via auto it that I can run from my thumb drive to add it machines that havenp++ installed. I work on a lot of lab machines and will want this everywhere. Thanks again.
-
I put it in my right-click context menu TWICE, once at the top and once at the bottom…that way it is VERY close to my right-click activation point no matter if that is near the top or the bottom of the editor window. :-)
-
I’ve been looking for this solution.
Could you please tell how I can add this item to right-click context menu?I tried to run it via run() command, but no luck.
Thanks
-
In the time since the original posting I have changed how I do this function. I no longer use an AutoIt script. But here’s how I would set it up again if I were doing it:
Create (and test) the functionality as a Run menu entry. For example, this might be something you would put in the The Program to Run box:
"C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "c:\example_script.au3"
.Execute this command to see that it actually works! (rather important before proceeding)
Save this new Run menu command with a name, e.g.
AutoIt3 TEST
After it is tested and is working via the Run menu, then you can make a right-click context menu entry out of it. Edit the contextMenu.xml file and where you feel it is appropriate add a new line like this::
<Item MenuEntryName = "Run" MenuItemName = "AutoIt3 TEST" />
After restarting Notepad++, if all has gone well, you should see your new entry when you right click in a document tab window.