Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search in all files in a project in Sublime Text 3

Is there a way to search for a string in all files inside a project in Sublime Text 3? The string is not a method.

like image 996
Ivan Avatar asked Dec 11 '13 12:12

Ivan


People also ask

How do I select multiple files in Sublime Text?

To do so, you need to press Ctrl+K, then Ctrl+Shift+Up. You can repeat as many times as you like. Press Ctrl+K, then Ctrl+Shift+Up to open a new sub-window.

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.

How do I view folders in Sublime Text 3?

Then on sublime text go to view>sidebar>show sidebar. Finally, 3 tabs away from view is a project tab. Click on project> add folder to project.. and then choose the folder you downloaded/unziped to your computer.


2 Answers

You can search a directory using FindFind in files. This also includes all opened tabs.

The keyboard shortcut is Ctrl+F on non-Mac (regular) keyboards, and +F on a Mac.

You'll be presented with three boxes: Find, Where and Replace. It's a regular Find/Find-replace search where Where specifies a file or directory to search. I for example often use a file name or . for searching the current directory. There are also a few special constructs that can be used within the Where field:

<project>,<current file>,<open files>,<open folders>,-*.doc,*.txt 

Note that these are not placeholders, you type these verbatim. Most of them are self-explanatory (e.g. -*.doc excludes files with a .doc extension).

Pressing the ... to the right will present you with all available options.

After searching you'll be presented with a Find results page with all of your matching results. To jump to specific lines and files from it you simply double-click on a line.

like image 189
keyser Avatar answered Sep 19 '22 13:09

keyser


You can put <project> in "Where:" box to search from the current Sublime project from the Find in Files menu.

This is more useful than searching from the root folder for when your project is including or excluding particular folders or file extensions.

like image 45
Efreeto Avatar answered Sep 19 '22 13:09

Efreeto