Skip to content

Instantly share code, notes, and snippets.

@o-az
Created April 28, 2026 17:20
Show Gist options
  • Select an option

  • Save o-az/03cfd4a3d33b6faaf752c8f68f54314b to your computer and use it in GitHub Desktop.

Select an option

Save o-az/03cfd4a3d33b6faaf752c8f68f54314b to your computer and use it in GitHub Desktop.
Defined in ~/.config/fish/functions/lsgrep.fish
# Defined in ~/.config/fish/functions/lsgrep.fish
function lsgrep --description 'Wildcard folder/file search'
# Convert search to regex: change .X to \.X, ? to ., and space or * to .*?
set -l needle (echo $argv|sed -E 's/\.([a-z0-9]+)$/\\\.\1/'|sed -E 's/\?/./'| sed -E 's/[ *]/.*?/g')
command ag --hidden --depth 3 -SUg "$needle" 2>/dev/null
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment