Skip to content

Commit

Permalink
Exclude file|folder_exclude_patterns
Browse files Browse the repository at this point in the history
If `use_global_exclude_patterns: true` is set, uses `folder_exclude_patterns` and `file_exclude_patterns` patterns (from global settings) to match against directories and files respectively, and not include them in the index.
  • Loading branch information
laggingreflex committed Jul 1, 2016
1 parent a28e4e5 commit 55777d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ such patterns:
{ "dired_hidden_files_patterns": [".*", "__pycache__", "*.pyc"] }
```

### Exclude Patterns

By default, FileBrowser shows all files and directories otherwise excluded by your `file_exclude_patterns` and `folder_exclude_patterns`.
To exclude those set `use_global_exclude_patterns: true`

### VCS integration
In case `git status`(or `hg status`) returns a colorable output in current directory, the modified
and untracked files will be designated by orange and green icons respectively.
Expand Down
13 changes: 9 additions & 4 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,20 @@ def prepare_filelist(self, names, path, goto, indent):
level = indent * int((len(ind) / tab) + 1) if ind else indent
files = []
index_dirs = []
exclude_dirs = self.view.settings().get('folder_exclude_patterns')
index_files = []
exclude_files = self.view.settings().get('file_exclude_patterns')
use_exclude_patterns = self.view.settings().get('use_global_exclude_patterns')
for name in names:
full_name = join(path, goto, name)
if isdir(full_name):
index_dirs.append(u'%s%s' % (full_name, os.sep))
items.append(''.join([level, u"▸ ", name, os.sep]))
if use_exclude_patterns == None or use_exclude_patterns == True and not any(fnmatch.fnmatch(name, p) for p in exclude_dirs):
index_dirs.append(u'%s%s' % (full_name, os.sep))
items.append(''.join([level, u"▸ ", name, os.sep]))
else:
index_files.append(full_name)
files.append(''.join([level, u"≡ ", name]))
if use_exclude_patterns == None or use_exclude_patterns == True and not any(fnmatch.fnmatch(name, p) for p in exclude_files):
index_files.append(full_name)
files.append(''.join([level, u"≡ ", name]))
index = index_dirs + index_files
self.index = self.index[:self.number_line] + index + self.index[self.number_line:]
items += files
Expand Down

0 comments on commit 55777d5

Please sign in to comment.