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