From 5dd959070ce9b1af98634b8731e9ef7b0563c637 Mon Sep 17 00:00:00 2001 From: Date Huang Date: Fri, 19 Aug 2016 18:58:37 +0800 Subject: [PATCH] Fix brew completion for `brew install` (#3309) * Fix brew completion for `brew install` * Using `brew search` rather than `brew --repository` - Homebrew migrated the directory holding their Formulas into Taps, breaking fish's completions. - New method to find all Homebrew-core Formulas - Compatible with old versions of Homebrew and more future proof * Replace fixed path to search formula with `brew --repository` * Replace `sed` with builtin `string replace` --- share/completions/brew.fish | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/share/completions/brew.fish b/share/completions/brew.fish index d4beb2819..2a8cd01e8 100644 --- a/share/completions/brew.fish +++ b/share/completions/brew.fish @@ -17,9 +17,16 @@ function __fish_brew_using_command end function __fish_brew_formulae - set -l formuladir (brew --repository)/Library/Formula/ - # __fish_complete_suffix .rb - ls $formuladir/*.rb | sed 's/.rb$//' | sed "s|^$formuladir||" + # list all local formula, do not use `brew search some_text` against searching online + # TODO fix the problem with `tap-pin`, tap-pin will modify the priority + # If you pin your custom tap for VIM, you should + # `brew install homebrew/core/vim` to install VIM from `core` repo + # `brew install vim` to install VIM from more prior repo + # but `brew search` won't change display for custom VIM and core VIM + # 'vim' for core VIM + # 'custUser/custRepo/vim' for more prior VIM + # more info: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/brew-tap.md#formula-duplicate-names + brew search end function __fish_brew_installed_formulas