Sublime Forum

New find in files, exclude dirs?

#5

+1; searching an entire project and excluding a set of dirs by pattern is invaluable…

I have tried the following from another post. It does not work for me.
is this correct? should we be able to exclude dirs in this way?


CODE: SELECT ALL
.;-*.css;-CVS
Will search all files, skipping over .css files and skipping anything with CVS in the path

this does not do anything except search all files and all folders

0 Likes

#6

For some of us this might be a solution: adding “folder_exclude_patterns” to the sublime-project file.
Example:

[code]
{
“folders”:

	{
		"path": "/projectdir/myproject",
		"folder_exclude_patterns": "target", "cache", "log"]
	}
]

}[/code]
These subdirectory’s are now completely ignored by Sublime.

0 Likes

#7

Any chance on getting this -CVS functionality added to the find files and folder in ST2?

I’m using the folder_exclude_patterns for the moment and it’s ok, but it would still be nice to be able to exclude a dir when searching.

For instance I have a test dir and using *.*;-*test* or just -*test* still returns results from the test dir.

0 Likes

#8

Actually scrap that, even with the exclude_folder it returns matches from those dirs.

The dirs aren’t shown in the sidebar, but it’s still getting hits from those files.

0 Likes

#9

+1

0 Likes

#10

Show your support here.

I upvoted. Annoying as hell.

0 Likes

#11

This is also an issue here

When working on big Django project, model migrations files generated by South are numerous and big, and completely pollute search results.

RM

0 Likes

#12

Please fix this!! :stuck_out_tongue:

0 Likes

#13

Since we’re about it, why not also completing the picture and adding “include_patterns”?
See sublimetext.userecho.com/topic/5 … ct-config/

0 Likes

#14

Find in Files has always supported include pattens, and as of nightly 2191, dirs can be excluded

0 Likes

#15

The addition of exclude dirs from find and replace is very welcome and appreciated.

The problem presented in this thread is a little bit different. As suggested by ludder a preference in projects to control “folder_exclude_patterns” would be useful.

Whenever I search inside a project I get results from “.git” folders and other folders that I wish to exclude always from search results.

Writing -.git will probably work but is not that practical.

Regards

0 Likes

#16

folder_exclude_patterns already exists for projects: sublimetext.com/docs/2/projects.html

0 Likes

#17

Yes, sorry.

I was referring to the possibility to actually show a folder in sidebar but exclude it from Find and Replace.

My opinion is that showing a folder in sidebar and exclude it from Find and Replace are two different unrelated things.

0 Likes

#18

A slightly confusing thing is that the exclude filter for a directory has to be written like this:

-/dirtoexclude/

instead of a simpler

-dirtoexclude

Or maybe I’m just not used to how ST2 handles filters yet (and haven’t found proper documentation on it).

0 Likes

#19

Thanks folks. “folder_exclude_patterns” was all I needed for my purposes.
Good luck with the further feature requests.

0 Likes

#20

In case anyone else comes here looking for how to exclude all subdirectories (ie. subfolders), as I just did, here’s what I found works:

-<project root directory name, not path>/*/*

If the folder is named ‘scripts’, it’d be: -scripts/*/*

If there are two root folders foo and bar, and you only want to search through their files, but not the folders they contain, you’d use

-foo/*/*,-bar/*/*

I also tried -(foo|bar)// but it didn’t work. Anyone know if there’s a shorter syntax that what I’ve got here?

0 Likes

#21

It does not work, where do you put that?

0 Likes

#22

I do: Find -> Find in Files; search for “state” hit “find” I got this:
dl.dropboxusercontent.com/u/930 … esults.txt

Is very frustrating, I deal with that thing every single day, it looks to me as if we don’t search for things in our folders?

I want to: show a folder in sidebar, exclude that folder from search. Can you please help me?

0 Likes

#23

Doesn’t work here either.

-foo/*/*,-bar/*/* should be equivalent to -foo/*,-bar/*.

0 Likes

#24


github.com/titoBouzout/FindExcludePatterns

0 Likes