Search code examples
regexgrepzshagfzf

Expand command line exclude pattern with zsh


I'm trying to pass a complicated regex as an ignore pattern. I want to ignore all subfolders of locales/ except locales/US/en/*. I may need to fallback to using a .agignore file, but I'm trying to avoid that.

I'm using silver searcher (similar to Ack, Grep). I use zsh in my terminal.

This works really well and ignores all locale subfolders except locales/US:

ag -g "" --ignore locales/^US/ | fzf

I also want to ignore all locales/US/* except for locales/US/en Want I want is this, but it does not work.

ag -g "" --ignore locales/^US/^en | fzf

Thoughts?


Solution

  • Add multiple --ignore commands. For instance:

    ag -g "" --ignore locales/^US/ --ignore locales/US/^en