nvim-telescope / telescope-fzf-native.nvim

FZF sorter for telescope written in c
1.36k stars 45 forks source link

This extension doesn't exist or is not installed: fzf #47

Closed tamis-laan closed 2 years ago

tamis-laan commented 2 years ago

I'm getting the following error when I startup neovim:

 This extension doesn't exist or is not installed: fzf

Not sure what is happening here, if I'm correct the binary should be build automatically.

raiyuza commented 2 years ago

Hi, i am experiencing the same problem. I'll provide a bit more debug info.

Without telescope fzf require we get the following message as expected.

[vim-plug] nvim-telescope/telescope-fzf-native.nvim Invalid argument type (expected: string or dictionary)

Naturally this will lead you to enabling the plugin by adding the following line of code

require('telescope').load_extension('fzf')

Which will result in the former mentioned error. ...telescope.nvim/lua/telescope/_extensions/init.lua:12: This extension doesn't exist or is not installed: fzf

So now I am debugging this by running checkhealth telescope giving us the following output.

## Checking for required plugins                                        
  - OK: plenary installed.
  - OK: nvim-treesitter installed.                                                         

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0                                                         
  - OK: fd: found fd 8.3.0  

## ===== Installed extensions =====

Now i came to the conclusion something must have gone wrong when plug tries to make fzf binary, since it doesn't get shipped. So i try to build it locally. From the path ...plugged/fzf

We get the following message

.config/nvim/plugged/fzf --> make Makefile:15: *** Not on git repository; cannot determine $FZF_VERSION. Stop. ERROR:2

ERROR:2 is the exit code

Aaah so there must be a bug in the make script, because it can't substring the git tag correctly. Trying to circumvent this to make it build can easily be achieved by exporting the required ENV variable.

Ex. export FZF_VERSION=$(fzf --version) but wait, now the git tag will be added and the script will give a bunch of errors like such.

bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `sed "s/-.*//" <<< 0.28.0 (e4c3ecc)'

Yeah, as expected. So now we force it to 0.28.0 by export FZF_VERSION='0.28.0'

Now make will build the our binary :D, problem solved right? Nope. The binary works

 nvim/plugged/fzf/bin --> stat fzf
  File: fzf -> /bin/fzf
  Size: 8               Blocks: 0          IO Block: 4096   symbolic link
Device: 254,4   Inode: 3015151     Links: 1
Access: (0777/lrwxrwxrwx)  Uid: ( 1000/tverdonck)   Gid: ( 1000/tverdonck)
Access: 2021-12-04 20:48:44.989499191 +0000
Modify: 2021-12-04 20:47:44.192834439 +0000
Change: 2021-12-04 20:47:44.192834439 +0000
 Birth: 2021-12-04 20:47:44.192834439 +0000

So, in conclusion.

  1. There is a bug in the make script. (I'll try to solve this if i can myself)
  2. The binary exists within the plugged (plugin folder) and works as expected.
  3. After manually building it like this Telescope is still unable to find it under extensions. See below the complete configuration after manually building it.
require('telescope').setup{                                                                     
--  defaults   = {},                                                                            
--  pickers    = {},                                                                            
  extensions = {                                                                                
    fzf = {                                                                                     
      fuzzy = true,                    -- false will only do exact matching                     
      override_generic_sorter = true,  -- override the generic sorter                           
      override_file_sorter = true,     -- override the file sorter                              
      case_mode = "smart_case",        -- or "ignore_case" or "respect_case"                    
    }                                                                                           
  }                                                                                             
}                                                                                                                                                                                         
require('telescope').load_extension('fzf')    

And we are back at the start again

...lugged/telescope.nvim/lua/telescope/_extensions/init.lu a:12: This extension doesn't exist or is not installed: fzf

I am also quite clueless what's happening here. I have been a programmer for a long time and have been working on this rabbit-hole of a issue for like 6 hours now. Hope some people might shed light on what's going on. I am completely new to LUA. So i am hoping that this just has something todo with cpath or something simple as directory structure or a dumb mistake in my code.

PS: Directory structure

lua
├── autocmds.lua
├── bootstrapper.lua
├── helpers
│   ├── autocmd.lua
│   ├── filesystem.lua
│   ├── init-helper.lua
│   ├── init.lua
│   └── keybindings.lua
├── plugins
│   ├── bootstrapper.lua
│   ├── configurations
│   │   └── telescope.lua <-- where the former configuration (setup and require) are located)
│   └── init.lua
└── telescope

I hope this helps us find the problem ~cheers

Conni2461 commented 2 years ago

You need to tell me if my install instructions arn't clear enough. This plugin telescope-fzf-native.nvim has nothing to do with junegunn/fzf and the fzf binary.

To install it you need to put

Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' }

in your plugin section. This will build a c library, a small re implementation of the fzf algorithm, we then can use inside telescope. So if you are doing require('telescope').load_extension('fzf') and still get: doesn't exist the binary was probably not compiled.

Go into .config/nvim/plugged/telescope-fzf-native.nvim and run make. It should take not more than half a second and will result into a new directory called build with a libfzf.so inside. Again not .config/nvim/plugged/fzf !!! you can still have junegunn/fzf installed, its an amazing cli tool but it wont get this plugin up and running.

Note: If you are using packer the directories are slightly different.

That its a c port of fzf is mentioned here: https://github.com/nvim-telescope/telescope-fzf-native.nvim#telescope-fzf-nativenvim and how to get it running here https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation so i am not sure how i can improve the documentation, so people dont spent 6 hours, debugging in the wrong directory :grimacing:

raiyuza commented 2 years ago

@Conni2461

THIS IS UTTER BS IGNORE THIS COMMENT.

The default copy and paste in plug will not work. Make will not execute because of mentioned bug with versioning. I'll start over and try again with your instructions and report back here. And don't feel bad for 6 hour debugging. Like i said i am new to LUA idfk what is going on at all so it's all a learning experience :)

Conni2461 commented 2 years ago

This command works. I am using it, i know several people who are using it. There is not even a $FZF_VERSION in the Makefile. You were looking in the wrong directory. You need to read more careful. The directory is called telescope-fzf-native.nvim. All the makefile does is a cc. It works on multiple machines for me and in CI.

raiyuza commented 2 years ago

I figured out what i think we are doing wrong. This is me atleast i can't speak for OP. I wrongly included the make post hook in plug. Causing the plugin not to install at all. My bad.

My issue is resolved. Your documentation is fine, i just had a blind spot moment. My apologies for taking your time.

Thanks for looking into this.

tamis-laan commented 2 years ago

So I read the documentation again and ran make inside the "root" directory i.e. ~/.vim/plugged/telescope-fzf-native.nvim/. I feel like this documentation could be more clear, especially given the fact that the install instructions already provide Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } do make in there.

raiyuza commented 2 years ago

So I read the documentation again and ran make inside the "root" directory i.e. ~/.vim/plugged/telescope-fzf-native.nvim/. I feel like this documentation could be more clear, especially given the fact that the install instructions already provide Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } do make in there.

Do make doesn't seem to even function in the plug scope. But that might again be to my lack of understanding of LUA

I had to manually run it in the specific plugin directory

Conni2461 commented 2 years ago

vim plug has do: https://github.com/junegunn/vim-plug#plug-options and packer.nvim has run: https://github.com/wbthomason/packer.nvim#specifying-plugins

Both work for me.

vim plug has absolutely nothing to do with LUA

raiyuza commented 2 years ago

@Conni2461To clarify, i'll give an example. I f up the LUA on my part so i did not execute the make command.

local Plug = vim.fn['plug#']                                                                                                                                                                    

vim.call('plug#begin', '~/.config/nvim/plugged')     
    Plug ('nvim-telescope/telescope-fzf-native.nvim', {                                                                                                                                         
            ['do'] = function()                                                                                                                                                                 
                vim.call('make')                                                                                                                                                                
            end                                                                                                                                                                                 
    })

So, you are right on both accounts. Again for me this issue can be closed/is no longer an issue for me. Maybe OP made the same mistake.

I had to manually run make as you said in the right plugin directory. Your documentation again is fine. I am converting my old setup to a new setup written in total LUA. I got blind sided, again you don't need to waste any more time on this :)

Thanks again for your time

tamis-laan commented 2 years ago

vim plug has do: https://github.com/junegunn/vim-plug#plug-options and packer.nvim has run: https://github.com/wbthomason/packer.nvim#specifying-plugins

Both work for me.

vim plug has absolutely nothing to do with LUA

For me it doesn't work, I need to manually run make in order to resolve the problem. I'm using the latest version of Plug.

Liquidmantis commented 2 years ago

I'm using Packer and had this problem as well. I had to go into ~/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim and run make manually, then it started working fine.

In my case it was also user error. I had installed the plugin via Packer without the make parameter and added it after the fact. Even though I saw a packer.compile message in my command window it apparently didn't build. I removed telescope-fzf-native.nvim and reinstalled via Packer with the make parameter there and it built automatically as expected.

Conni2461 commented 2 years ago

@raiyuza I dont get you. Why do you try to mix use plug in lua. If you wanna do init.lua use packer. If you do init.vim use vim-plug. This just leads to mistakes because you do not fully understand lua. Read the nanotee guide: https://github.com/nanotee/nvim-lua-guide

This is a minimal rc in lua using vim-plug that just works:

vim.cmd [[
  set runtimepath=$VIMRUNTIME
  set runtimepath+=/tmp/nvim
]]

if vim.fn.isdirectory("/tmp/nvim/autoload") == 0 then
  print("Installing Telescope and dependencies.")
  vim.cmd [[
    silent !mkdir -p /tmp/nvim/autoload/
    silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > /tmp/nvim/autoload/plug.vim
    augroup plug
      au!
      au VimEnter * PlugInstall
    augroup END
  ]]
end

local Plug = vim.fn["plug#"]

vim.call("plug#begin", "/tmp/nvim/plugged")
Plug("nvim-telescope/telescope-fzf-native.nvim", {
  ["do"] = "make"
})

vim.call("plug#end")

You can run it with nvim -nu file.lua and it installs vim-plug in /tmp/nvim/autoload and fzf-native in /tmp/nvim/plugged/telescope-fzf-native.nvim/ and if you look in there you can see that the binary was build.

You can find a minimal rc using packer here: https://github.com/nvim-telescope/telescope.nvim/blob/master/.github/ISSUE_TEMPLATE/bug_report.yml It works the same.

@tamis-laan Unless you tell me what lines you put in your config, i cant help you. "It doesnt work" is not a really bug report that tells me anything.

@Liquidmantis If you put this in after you already installed the plugin run will run make. run means that make will run on install or on update if new commits are there and are pulled. Thats why it didnt work.

I am closing this

benfrain commented 2 years ago

Same issue here. Neovim 0.6.0, added into Packer as per install docs: use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }, packer compiles but restarting and trying to use Telescope gives me the packer.nvim: Error running config for telescope.nvim: ...er/opt/telescope.nvim/lua/telescope/_extensions/init.lua:12: This extensi on doesn't exist or is not installed: fzy error.

Ran make from ~/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim which just gave me a make: Nothing to be done forall'.` message.

Conni2461 commented 2 years ago

"This extensi on doesn't exist or is not installed: fzy"

you wanna do "fzf" not "fzy"

require('telescope').load_extension('fzf')
benfrain commented 2 years ago

"This extensi on doesn't exist or is not installed: fzy"

you wanna do "fzf" not "fzy"

require('telescope').load_extension('fzf')

LMAO – so sorry!

raiyuza commented 2 years ago

@Simon Hauser,

I Already told you several times, i fucked up and it's working as it is now. And you could close the issue. Why are you becoming hostile? I already ack the fact that i know f all about LUA,

Sigh

On Fri, 10 Dec 2021 at 16:35, Simon Hauser @.***> wrote:

"This extensi on doesn't exist or is not installed: fzy"

you wanna do "fzf" not "fzy"

require('telescope').load_extension('fzf')

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nvim-telescope/telescope-fzf-native.nvim/issues/47#issuecomment-991119096, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXQGGU7XPRETPMCZUJUT7TUQIT43ANCNFSM5JMSGULQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Bedankt voor uw reply.

Met vriendelijke groet, Timothy Alexander Verdonck

Conni2461 commented 2 years ago

The issue is closed. I answered a different person, who asked a question here ...............

benfrain commented 2 years ago

@raiyuza he's replying to me, not you. I made a dumb 'error between keyboard and chair'. I didn't feel @Conni2461 was being hostile in any way.