nha
nha

Reputation: 18005

Projectile search only part of the project

When using emacs Projectile and helm-projectile, I am used to search for text inside the whole project. However is there a way to search only part of the project?

Something like:

Upvotes: 6

Views: 2750

Answers (3)

Javed
Javed

Reputation: 6239

Install helm-ag, this requires silversearcher-ag package; for debian apt install silversearcher-ag. And then you can

  1. helm-do-ag to search inside a sub-folder/directory inside project
  2. to ignore sub-folders/directories add them to either .gitignore or .hgignore if it is git and hg project respectively or add then to .projectile file, details here.

references:

  1. https://github.com/emacsorphanage/helm-ag
  2. https://github.com/ggreer/the_silver_searcher

Upvotes: 2

nha
nha

Reputation: 18005

For now I am using rgrep, which prompts for a string and a directory to find.

I would be happy to hear about an equivalent solution using ag, and I should mention I haven't yet dug into the link from @goromlagche (https://github.com/ggreer/the_silver_searcher#emacs).

Upvotes: 3

Ehvince
Ehvince

Reputation: 18395

Yes you can exclude (sub) folders. Add a line in your .projectile:

-/sub/folder

So search inside a subfolder, I don't see something automatic. You could put project files in some subfolders (https://projectile.readthedocs.io/en/latest/configuration/#file-local-project-root-definitions) and switch projects.

Upvotes: 5

Related Questions