Skip to content
Snippets Groups Projects
Commit 3afacc35 authored by tim smith's avatar tim smith
Browse files

Speed up tab completion

Fixes #20. Closes #23.
parent fad235d8
No related branches found
No related tags found
No related merge requests found
......@@ -45,23 +45,9 @@ __brewcomp ()
__brew_complete_formulae ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local lib=$(brew --repository)/Library
local taps=${lib}/Taps
local ff=$(\ls ${lib}/Formula 2>/dev/null | sed 's/\.rb//g')
local af=$(\ls ${lib}/Aliases 2>/dev/null)
local tf file
for file in ${taps}/*/*/*.rb ${taps}/*/*/Formula/*.rb ${taps}/*/*/HomebrewFormula/*.rb; do
[ -f "$file" ] || continue
file=${file/"Formula/"/}
file=${file/"HomebrewFormula/"/}
file=${file#${lib}/Taps/}
file=${file%.rb}
file=${file/homebrew-/}
tf="${tf} ${file}"
done
COMPREPLY=($(compgen -W "$ff $af $tf" -- "$cur"))
local formulas="$(brew search)"
local shortnames="$(echo "$formulas" | grep / | cut -d / -f 3)"
COMPREPLY=($(compgen -W "$formulas $shortnames" -- "$cur"))
}
__brew_complete_installed ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment