cloudhead / neovim-fuzzy

Minimalistic fuzzy file finding for neovim
BSD 3-Clause "New" or "Revised" License
111 stars 17 forks source link

[Bug] `hg` command not found #50

Closed alexmozaidze closed 11 months ago

alexmozaidze commented 3 years ago

I don't have hg installed, and whenever I try to fuzzy search it gives an error (every time), and after I hit enter it works fine. I found solution to the problem, that is to manually set g:fuzzy_rootcmds to only have the programs you have on the system (for me it's git).

cloudhead commented 3 years ago

Hmm strange. The second command is only called if the first one fails, which uses git.

Josh-Rosen commented 2 years ago

Thanks @alexmozaidze I had the same problem on the new Apple M1 Max Macbook. I set this in my init.vim: let g:fuzzy_rootcmds = [ \ ["git", "rev-parse", "--show-toplevel"], \ ] with the original being https://github.com/cloudhead/neovim-fuzzy/blob/0bef4e1a81c65fc05d31380dd74454bd67733837/plugin/neovim-fuzzy.vim#L34-L37

I didn't have hg or root installed.

davidhaley commented 2 years ago

This worked for me (in init.lua): vim.cmd('let g:fuzzy_rootcmds = [ ["git", "rev-parse", "--show-toplevel"] ]')

finrails commented 1 year ago

This worked for me (in init.lua): vim.cmd('let g:fuzzy_rootcmds = [ ["git", "rev-parse", "--show-toplevel"] ]')

I'm also using vim with init.lua config file, and it has worked very well for me.

asparagii commented 11 months ago

@cloudhead

If you perform :FuzzyOpen outside a git repository, git rev-parse --show-toplevel fails. After that, hg root gets called. git rev-parse --show-toplevel is run, returns an error and is handled properly, while hg root cannot be run since hg is does not exist and so system(cmd) throws.

My guess is that the function should use executable(cmd) ([doc](https://vimdoc.sourceforge.net/htmldoc/eval.html#executable())) before calling system(cmd)

cloudhead commented 11 months ago

Hmm yeah, that makes sense!

cloudhead commented 11 months ago

Fixed in 16ee769bb459e8173a2ef9f515905c8f879ff7c6