neovim-fuzzy icon indicating copy to clipboard operation
neovim-fuzzy copied to clipboard

[Bug] `hg` command not found

Open alexmozaidze opened this issue 3 years ago • 2 comments

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).

alexmozaidze avatar Oct 06 '21 22:10 alexmozaidze

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

cloudhead avatar Oct 09 '21 18:10 cloudhead

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.

Josh-Rosen avatar Dec 09 '21 08:12 Josh-Rosen

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

davidhaley avatar Nov 03 '22 11:11 davidhaley

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.

finrails avatar May 20 '23 18:05 finrails

@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) before calling system(cmd)

asparagii avatar Nov 24 '23 14:11 asparagii

Hmm yeah, that makes sense!

cloudhead avatar Nov 25 '23 11:11 cloudhead

Fixed in 16ee769bb459e8173a2ef9f515905c8f879ff7c6

cloudhead avatar Nov 25 '23 11:11 cloudhead