Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

sublimetext2

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

like image 831
Rob Bednark Avatar asked Feb 23 '13 00:02

Rob Bednark


People also ask

How do I search all files in Sublime Text?

Use the Search all shortcut: Ctrl + Shift + F , then select the folder in the "Where:" box below. (And for Mac, it's ⌘ + Shift + F ).

How do you collapse rows in Sublime Text?

Sublime Text has really good multiple selection support. Here's another way: select all 50 lines (with the mouse, maybe?) then press cmd+shift+right or shift+End, as above, and collapse it.

How do I search for a class in Sublime Text?

Ctrl + F, then search for some class or whatever you want in opened docs, or entire site.


1 Answers

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.

like image 162
fregante Avatar answered Sep 20 '22 10:09

fregante