Topic: https://brettterpstra.com/2018/11/07/shell-tricks-instant-wildcard-directory-search/
hide preview

What's next? verify your email address for reply notifications!

unverified 5y, 157d ago

Dear Brett,

how can this shell trick be modified for zsh?

Thank you!

Stephan

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 5y, 156d ago

It shouldn't be hard, most of the magic is in the ag command, not in the shell-specific stuff. That said, I'm not well-versed in Zsh (yet, that's next on my list of things to explore), so I'm not sure exactly what would need to be modified.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Brett 5y, 156d ago

But for the record, here's the Fish version:

function lsgrep -d "Wildcard folder/file search"
    set -l needle (echo $argv|sed -E 's/\.([a-z0-9]+)$/\\.\1/'|sed -E 's/\?/./'| sed -E 's/[ *]/.*?/g')
    ag --depth 3 -S -g "$needle" 2> /dev/null
end
hide preview

What's next? verify your email address for reply notifications!

Brett 5y, 156d ago [edited]

Actually, I just tested and it works fine as is in Zsh.

hide preview

What's next? verify your email address for reply notifications!