Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime text 2 find in folder with file extension

How do I search in a folder in sublime text 2 with file extension?

My where when I use:

*.js 

searches globally for all js files.

If I try to restrict it to a folder:

/project/*.js 

it matches nothing.

like image 966
Harry Avatar asked Jul 09 '13 18:07

Harry


People also ask

How do I search for text in a directory 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 ).

Can directories have file extensions?

YES directories are FILES on disk. NO they do not have a useable extension, but they do carry an extension of . dir in microsoft and dos based systems.

How do I show file extensions in CMD?

MS-DOS and Windows command line In MS-DOS, typing dir to list all files also displays the file extension of each file.


1 Answers

Instead of this:

/project/*.js 

Try using this:

project .js 

This should match files which have project in the path and have a .js extension

EDIT: The above assumes you're trying to find all the files with .js extension using the Goto Anything feature in Sublime Text.

In case you'd like to search within .js files located within a directory, you can add an Include Filter in the search path:

/project,*.js 

This will search for the text you've entered, limiting the scope to files within /project and it's sub-directories having the extension .js.

Reference: Sublime Text Docs - Search Scope

EDIT 2: For Sublime Text 3, refer Simons answer below.

like image 60
godfrzero Avatar answered Sep 19 '22 18:09

godfrzero