Sublime Forum

Selecting all results from Find in Files

#1

Suppose I use regex in Find in Files, and now have a buffer of results. Each search result is highlighted (has a border drawn around it) on a separate line in that buffer.

I haven’t found an easy way to select, then copy those results. Had I searched within a file, Find All would have selected every result for me.

In the end I simply selected everything in the result buffer, then searched again to do what I needed to do.

So really this is a “what could I have done?” question – or a feature request.

Thanks.

1 Like

#2

If you select Find All, then you can edit all selected fields st the same time. For example, in screen clip below, you could hit delete twice and remove all “the” content from your post above. Or you could type “e” once and convert every “the” into “thee” with an easy text edit.

0 Likes

#3

Thanks very much, RiverLeaf. Trouble is, the Find in Files… search variant doesn’t have a “Find All.” Is that hiding from me?

0 Likes

#4

No, Find in Files does not have a direct Find All button in it; the Find button will open a buffer/panel with the results in it and the Replace button will (after prompting you to proceed) open all files with matches and perform the replacement in them.

If you perform a Find in Files and then immediately do a Find in the result buffer, the regex that’s entered in the Find in Files panel should persist and be the default search in the Find panel as well.

As such a slightly shorter version of your original post would be to do the Find in Files operation, then do a Find and just hit Find All in that panel.

The downside to that is that the regex is likely to match the result at the top of the buffer that says what you were searching for, may (depending on your search) also match on the names of files, and might find more than you expect if you don’t close the buffer between successive find operations.

A potential solution to this on the plugin front would be a TextCommand that is only available in a Find in Files result buffer, which could grab the regex used in the search by looking at the first line, then find all results that aren’t files and select them for you that way.

0 Likes