Suggestion: Find in Files from command line
The idea is great, because then I can start a new instance easily and it is not blocking my current instance.
If I’m considering “calling out” like that, I’ll call out to a more capable searching program. :-)
And when that more-capable program shows me the hits and I want to go to one of them, I’ll have that program call back into Notepad++ to take me to the file and hit line.
Ekopalypse last edited by
I’m not sure I understand, but in the end it depends on personal preference anyway.
I mean, if I use Npp because of its search function, then I think I’m using the wrong tool for the job.
On the other hand, if I mainly edit, then it’s good to have a powerful search function like Npp has, and if it can be easily launched from Npp and doesn’t block me - all the better.
Well, in theory we could put together all we know and create the desired functionality via scripting…if it isn’t picked up natively. There’d be a lot of individual pieces, but I can’t think of anything that would be a “stopper”.
Ekopalypse last edited by
Yes, that (usually) always works :-D
And some of the pieces are:
- invoke new instance of N++ with new parameters on the command line
- command line pickoff of parameters (@Ekopalypse has showed us how to do this in the past)
- invoking of the Find in Files dialog after N++ startup
- filling in the fields on Find in Files with command line data
- starting the Find in Files running
So, okay, only 4 basic steps, but some of those steps have a lot of “meat” to them.
I don’t know that I have sufficient interest in the base topic to work up a script, but the script-writer in me thinks that writing it would be more fun than using it would be useful. :-)
YAREST (Yet Another Regular Expression Search Tool)
I use grepWin from Stefans Tools.
It’s FOSS, it’s also available in the PortableApps.com platform, it uses Boost (or plain text) for searching, it can be easily configured to invoke Npp at the desired found line [ grepWin :: Settings > Editor ]:
C:\programs\Notepad++\notepad++.exe -n%line% "%path%"
it works well as a Run menu command:
<Command name="grepWin" Ctrl="no" Alt="no" Shift="no" Key="0">grepWin /searchpath:"$(CURRENT_DIRECTORY)" /filemask:"*.*"</Command>
and I find it nicely bridges the CL/GUI divide. It took a very small amount of work (a batch file wrapper) to make it assume folder and file extension defaults as I prefer them for regular CL invocations. [But sometimes I’ll still fire up GnuWin32 grep (for one thing it’s less to type <grin>)]
grepWin…it uses Boost
That it uses Boost’s regex engine is a bit obscure – it doesn’t seem to advertise that – is a definite plus for N++ users that are used to it for searching.
I don’t think the author considers it a major selling point; to many people RE is RE, right up until they get bitten by the flavor differences.
The author states on the mini help page on his website:
grepWin uses the boost regex engine to do its work, with the Perl Regular Expression Syntax.
The F1 help screen in grepWin has links to the top-level (non version specific) Boost documentation (which as of today has ‘release’ resolving to ‘1_77_0’):
The project source code on github for the current version (2.08) shows it using Boost 22.214.171.124.
I have not tried any form of “proof of Boostness” as I typically use grepWin for searches similar to: “Which files in this project reference a particular manifest constant?” or “Have I defined this word in another text file in this folder tree?”
It does offer a replace function, which works well with plain text replacements. I have only tried regex replacements a couple of times (it worked fine). By default, grepWin saves a copy of the original file with a .bak extension added for both replacement styles.
to many people RE is RE, right up until they get bitten by the flavor differences.
You said that very well. :-)
grepWin uses the boost regex engine to do its work, with the Perl Regular Expression Syntax
I’m not really sure what that means (the last part).
I’ve also seen other related references calling it PCRE (Perl Compatible Regular Expression) syntax.
To me, it’s “Boost RE syntax”.
I think my opening statement (BTW: I thought you’d like it) also covers the authors conflation of different RE namings.