diff --git a/README.md b/README.md index 0b0ee5d..5eff3c8 100644 --- a/README.md +++ b/README.md @@ -73,5 +73,10 @@ renameRepo: # Add extra static directories outside of the basedir extraDirs: - $HOME/.config/nvim + +# Exclude directories you don't want to include in the fuzzyfinder +excludeDirs: + - $HOME/src/gitlab.com/oldstuff + ``` diff --git a/internal/pkg/repo/discover.go b/internal/pkg/repo/discover.go index 4fdd61b..f54601d 100644 --- a/internal/pkg/repo/discover.go +++ b/internal/pkg/repo/discover.go @@ -48,6 +48,9 @@ func GetRepoPathsChan(basedir string, includeExtras bool) <-chan string { if !entry.IsDir() { continue } + if inExcludeList(basedir) { + continue + } if entry.Name() == ".git" { out <- basedir return @@ -66,6 +69,16 @@ func GetRepoPathsChan(basedir string, includeExtras bool) <-chan string { return out } +func inExcludeList(name string) bool { + excludes := viper.GetStringSlice("excludeDirs") + for _, exclude := range excludes { + if name == ExpandPath(exclude) { + return true + } + } + return false +} + func GetRepoPathsAsync(baseDir string, result *[]string) error { ch := GetRepoPathsChan(baseDir, true) for p := range ch {