wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.82k stars 266 forks source link

System fzf binary causing problems #987

Closed esn89 closed 2 years ago

esn89 commented 2 years ago

Steps to reproduce

Use homebrew/macports to install fzf to /opt/local/bin/fzf

Use my packer config:

return require("packer").startup(function(use)
    -- Packer can manage itself
    use("wbthomason/packer.nvim")

    -- fzf
    use("/opt/local/bin/fzf")
    use("junegunn/fzf.vim")
end)

Actual behaviour

What happens when I run :PackerInstall:

               packer.nvim - finished in 0.254s
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ✗ Failed to install /opt/local/bin/fzf

 Press 'q' to quit
 Press '<CR>' to show more info
 Press 'd' to show the diff
 Press 'r' to revert an update
 Press 'R' to retry failed operations

However, fzf does exist on that path:

which fzf
/opt/local/bin/fzf

Expected behaviour

I expect it to pick up that path so I can use fzf.vim

packer files

Post the contents of ~/.cache/nvim/packer.nvim.log here

return require("packer").startup(function(use)
    -- Packer can manage itself
    use("wbthomason/packer.nvim")

    -- fzf
    use("/opt/local/bin/fzf")
    use("junegunn/fzf.vim")
end)
MunifTanjim commented 2 years ago

That's not how you do it.

/opt/local/bin/fzf is the binary file, not the plugin directory.

You'll need to use the value of $(brew --prefix)/opt/fzf as stated here: https://formulae.brew.sh/formula/fzf

MunifTanjim commented 2 years ago

It'll be something like this: https://github.com/MunifTanjim/dotfiles/blob/5287c3ca89b7f773a3d8af6d8d78f3fe1c47062c/private_dot_config/nvim/lua/config/plugins.lua#L298-L301

With the fzf_root being:

vim.trim(vim.fn.system('brew --prefix')) .. '/opt/fzf'
esn89 commented 2 years ago

@MunifTanjim

I am using macports so I do not have the brew --prefix command. Macports installs everything in /opt/local/bin, including fzf.

I did do something similar, but still getting this:

    local fzf_root = '/opt/local/bin'
    if vim.fn.isdirectory(fzf_root) == 1 then
        use(fzf_root)
    use('junegunn/fzf.vim')
    end

But when I try to do, :Files, I see something like:

Screen Shot 2022-08-06 at 10 17 21 AM
MunifTanjim commented 2 years ago

/opt/local/bin is where the binary file lives. You need the directory where the plugin folder lives.

esn89 commented 2 years ago

@MunifTanjim

Hang on, I am now a bit confused.

So I need both, or only the plugin folder?

MunifTanjim commented 2 years ago

Try running port notes fzf, it should output something like this: https://github.com/macports/macports-ports/blob/260f33aa2a03fe0adb28933dbd00daf029163d09/sysutils/fzf/Portfile#L156-L168

And the directory should be something like /opt/local/share/fzf/vim... that's the directory you need.

local fzf_root = '/opt/local/share/fzf/vim'

So I need both, or only the plugin folder?

fzf_root should be set to where the plugin folder is located. In your case, it's probably /opt/local/share/fzf/vim.

esn89 commented 2 years ago

@MunifTanjim

Thanks for your reply.

So right now I have:

    local fzf_root = '/opt/local/share/fzf/vim'
    if vim.fn.isdirectory(fzf_root) == 1 then
        use(fzf_root)
        use('junegunn/fzf.vim')
    end

But now with this config, I get:

Screen Shot 2022-08-06 at 11 06 15 AM
MunifTanjim commented 2 years ago

can you run fzf --version from your terminal?

MunifTanjim commented 2 years ago

You should open issue on fzf.vim repo, this really has nothing to do with packer.nvim. Maybe check a few existing issues there: https://github.com/junegunn/fzf.vim/issues?q=failed+to+run ?

esn89 commented 2 years ago

@MunifTanjim

Of course, yes right here:

fzf --version
0.32.0 (MacPorts)
esn89 commented 2 years ago

@MunifTanjim I have fixed it. Turns out my vim was using the wrong shell.