Sublime Forum

New find in files, exclude dirs?

#1

It would be convenient to be able to exclude dirs in the new find-in-files panel (the same way as excluding patterns works with a “-”). This is coming up where we have a dir structure like the following:

/root/liba
/root/libb
...
/root/libn
/root/thirdpartylibs/... # massive source tree here

And it would be nice if we could search in “/root,-/root/thirdpartylibs”, as opposed to “/root/liba,/root/libb,…,/root/libn”.

John

0 Likes

Folder_exclude_patterns but show in sidebar?
#2

+1
I would like to exclude all stuff under “target” in my Java projects.

According to this topic Exclude files & directories from "Find in Files" it looks like that is should be possible to exclude directories (and it’s subdirectories). Couldn’t get it working though. “-target” doesn’t do the job…

0 Likes

#3

I also noticed this wasn’t working (I wanted to exclude cache files in my project tmp directory).

It’s possible to exclude folders from search by excluding them from a project (http://www.sublimetext.com/docs/2/projects.html), but this isn’t ideal because really it’s a different feature.

0 Likes

#4

It probably would be the best to optionally let users use a regex for selecting the subdirectories/files to search - afaik “Geany” offers this option and it works great.

0 Likes

#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