30

Is there any directory-wide search functionality in Sublime for the directory currently opened in the editor?

Or optionally a search all opened files? (If this exists do the files have to be opened in a tab or just visible on the sidebar?)

Mark Amery
  • 143,130
  • 81
  • 406
  • 459

3 Answers3

56

Yes there is.

On Windows

CTRL + SHIFT + F

On Macintosh

CMD + SHIFT + F

The Where field in the search panel determines where to search. You can define the scope of the search in several ways.

More: https://docs.sublimetext.io/guide/usage/search-and-replace.html

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
Ali Gajani
  • 14,762
  • 12
  • 59
  • 100
  • I have Sublime Text 3. Ctrl+Shift+F didn't work for me, but I found this option in the menu: Find -> "Find in Files..." – Anis Abboud Oct 05 '14 at 03:47
  • Do you have a folder open? I have Sublime Text 3 and it's working here (on a Mac). – Will Oct 21 '14 at 01:11
19

In Sublime Text 3

Right click on FOLDERS Navigation bar

Choose Find in Folder

enter image description here

vanduc1102
  • 5,769
  • 1
  • 46
  • 43
  • I had to remove "Sublime Sidebar Enhancements" plugin to see "Find in folder..." again. It's strange that it removes this functionality... – Maxime Lafarie Jan 28 '16 at 17:01
1
*/folder_name/*
  • In the "Where" section of the find-all dialogue (CtrlShift+F or Shift+F ), */folder_name/* will search folders called "folder_name" that are represented in your current session. For instance, if you have a file open with a path of C:\Users\joe\folder_name\file.js, you can use the *//* pattern to search any of those folders or combinations of folders: */joe/* and */Users/joe/* will both work. However, if you have a file like this C:\Users\timmy\folder_name\file.js that's not open, it won't search that (unless you explicitly name it, like in the next example).

Where to perform a folder search


C:\path\to\folder
  • You can also put in the absolute path to the folder you want to search. This is useful if you want to search a folder that is not represented in sublime (no files within that folder are currently open in sublime), or if you have two dirs with the same name, and you only want to search one. Personally, I never use this.

Path to folder example


C:\path\to\folder, */folder_name/*
  • You can also combine them.

To answer your last question, at some point Sublime started automatically searching all open files and represented folders, but if you want to be sure you can use one or all of these variables:

<project>,<current file>,<open files>,<open folders>

You can read more about searching at the unofficial sublime documentation. Or from this post, which is similar to your own.

Travis Heeter
  • 13,002
  • 13
  • 87
  • 129