This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-01
Channels
- # announcements (5)
- # aws (2)
- # babashka (35)
- # beginners (68)
- # bristol-clojurians (1)
- # calva (14)
- # cider (9)
- # clj-commons (5)
- # clojars (3)
- # clojure (101)
- # clojure-australia (6)
- # clojure-europe (35)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-spec (1)
- # clojure-uk (4)
- # clojurescript (70)
- # conjure (3)
- # cursive (7)
- # datomic (36)
- # emacs (11)
- # exercism (1)
- # fulcro (23)
- # helix (2)
- # jobs-discuss (15)
- # lsp (17)
- # malli (8)
- # meander (1)
- # nrepl (60)
- # off-topic (10)
- # pedestal (9)
- # react (8)
- # reagent (53)
- # reveal (10)
- # shadow-cljs (27)
- # spacemacs (4)
- # tools-build (4)
- # tools-deps (4)
- # xtdb (2)
When I do "search project" (SPC /), type some pattern (or just press SPC *
at the beginning),
then I would like to filter the results only coming from certain subdirectory - like SPC s f
but specifying the directory only after the search pattern.
Is there an easy way to achieve that?
If using ripgrep (and probably silver-searcher) exclude a file or directory with the -g!directory-name
option at the start of the search prompt
For example, to search for uses of the pattern token but avoid searching in a directory called customer-token within a project tree, I would use SPC /
to start the project search and type -g!customer-token token
. This will list all the files that have the pattern token
except for files inside the customer-token
directory.
https://practical.li/spacemacs/spacemacs-basics/working-with-projects/searching-projects.html#searching-specific-files
Thanks, John, a really good answer.
I'm in fact interested in including a directory, not excluding it.
But it's very similar to what you said - I just need to specify a proper glob like this -gmy-dir-name/** search-pattern
Ah yes the /**
is needed when including a specific directory and removing the !
of course
-gcompany-token/** token
from my earlier suggestion.
I think the /**
is supposed to be used when excluding a directory too, although it seemed to work without okay.