Rob Bednark
Rob Bednark

Reputation: 28202

Sublime Text: how to show only filenames in text search, or to "collapse all" results?

When doing a text search in Sublime Text, is there a way to only show the filenames that matched, and not show the actual lines that matched and the context around those lines?

I can go through each file and collapse those lines (mouseover the column between the line number in the first column and filename in the third column, reveal an arrow icon, click that arrow icon) -- is there a way to easily collapse all of them?

Sublime Text 2, v2.0.1, build 2217

Upvotes: 12

Views: 4653

Answers (2)

MikeA
MikeA

Reputation: 219

The way I deal with this is to perform the search, copy the entire result output and paste it into a new document. Then use 'Search Files' (ctrl-shift-F) and search that result file for "C:\Users\" with 'Show Context' deselected. That gives me a list of just the files and paths.

enter image description here

Upvotes: 4

fregante
fregante

Reputation: 31779

I had been wondering about this myself, but apparently the answer was simple. Use code folding.

Go to the menu Edit > Code Folding > Fold All. The keyboard shortcut on Mac is ⌘K, then ⌘1

Normal results:

Unfolded code

(Partially) folded results:

Partially folded/collapsed code

Apparently it doesn't work too well—some results stay unfolded, both in ST2 and ST3—but it's something.

Upvotes: 25

Related Questions