From e14f5a333304394608ee327218a8b963e14e6cd4 Mon Sep 17 00:00:00 2001 From: Rami Taibah Date: Sun, 4 Jun 2023 15:11:11 +0300 Subject: [PATCH] Update the check for fzf installed via homebrew * Update the check for fzf installed via homebrew * The existing check for fzf installed via homebrew doesn't work form Apple silicon macs, nor does it work for those who use homebrew of Linux. * Add brew_fzf_path variable to get the brew prefixed path * Update the isdirectory conditional to check this variable and use it for the Plug function call if it is a directory. * Closes thoughtbot#681 Co-authored-by: Daniel Nolan --- vimrc.bundles | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vimrc.bundles b/vimrc.bundles index 633a44f5a5..fbf1d8a0bf 100644 --- a/vimrc.bundles +++ b/vimrc.bundles @@ -19,8 +19,12 @@ Plug 'christoomey/vim-run-interactive' " If fzf has already been installed via Homebrew, use the existing fzf " Otherwise, install fzf. The `--all` flag makes fzf accessible outside of vim -if isdirectory("/usr/local/opt/fzf") - Plug '/usr/local/opt/fzf' +if executable("brew") + let g:brew_fzf_path = trim(system("brew --prefix fzf")) +endif + +if exists("g:brew_fzf_path") && isdirectory(g:brew_fzf_path) + Plug g:brew_fzf_path else Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } endif