fzf.devicon.vim icon indicating copy to clipboard operation
fzf.devicon.vim copied to clipboard

FilesWithDevicons fails

Open iameru opened this issue 2 years ago • 7 comments

:GFilesWithDevicons and :RgWithDevicons work great.

:FilesWithDevicons on the other hand opens the fzf window but just shows

[Command failed: | devicon-lookup]

Not sure where to start looking for the why.

NVIM v0.8.3
Dev Icon Lookup v0.8.1
latest fzf.devicon.vim

iameru avatar Feb 18 '23 11:02 iameru

Hey @iameru!

Hmm I don't think I can reproduce this on my end...

What is your FZF_DEFAULT_COMMAND env var set to? https://github.com/coreyja/fzf.devicon.vim/blob/master/autoload/fzf/devicon/vim.vim#L368

That is used in FilesWithDevicons to determine what to run to search for files

Since your other devicon-lookup commands are working it feels like the devicon-lookup binary and everything is working well

Thanks for trying out fzf.devicon.vim! Hope we can get this resolved for ya

coreyja avatar Feb 18 '23 15:02 coreyja

What is your FZF_DEFAULT_COMMAND env var set to? https://github.com/coreyja/fzf.devicon.vim/blob/master/autoload/fzf/devicon/vim.vim#L368

I don't have it set apparently, but have devicons in my Path

~$ echo "$FZF_DEFAULT_COMMAND"

~$ which devicon-lookup
/home/user/.cargo/bin//devicon-lookup

I hope aswell. It's nice to have visual feedback in my editor. Not using Files that often though so its not soooo important but maybe we can find the reason

iameru avatar Feb 21 '23 12:02 iameru

@iameru Can you try setting that env var as a work around for right now?

Mine is set to this to use rg

rg --files --no-ignore --hidden --follow --glob "!.git/*" 2> /dev/null

Haven't been in this code base in awhile lol, but I'm not actually seeing a fallback if $FZF_DEFAULT_COMMAND isn't defined in code right now... So that might be the issue!

Will try to get that patched if setting the env var works for ya!

coreyja avatar Feb 21 '23 19:02 coreyja

got some time to try again. Still an error [Command failed: | devicon-lookup when using :FilesWithDevicons.

$ echo "$FZF_DEFAULT_COMMAND"                                                                                                                   13.7s
rg --files --no-ignore --hidden --follow --glob "!.git/*" 2> /dev/null

2023-03-10-112536_821x243_scrot

iameru avatar Mar 10 '23 10:03 iameru

I just went and hardcoded the following line in the vim.vim file. Now it worked.

  " let args.source = $FZF_DEFAULT_COMMAND.' | devicon-lookup'
  let args.source = 'rg --files --no-ignore --hidden --follow --glob "!.git/*" 2> /dev/null | devicon-lookup'

iameru avatar Mar 10 '23 10:03 iameru

@iameru Ahh glad you found a workaround!

I'll still try to take a look at this sometime soon

coreyja avatar Mar 10 '23 21:03 coreyja

Ok, So I was trying again. Setting the ENV correctly via export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*" 2> /dev/null' actually worked.

so the loading in line 368 does its job properly.

in the readme.md it says: ... (runs $FZF_DEFAULT_COMMAND if defined) which is not really true. (as it runs it regardless, there is no if)

Maybe there need to be a reminder - or drop the support for FZF_DEFAULT_COMMAND, as I was never aware until raising this issue that this exists and still don't know why I should set this myself

iameru avatar Mar 11 '23 10:03 iameru