junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
62.23k stars 2.35k forks source link

Slow preview command with PowerShell on Linux #2006

Open thorstenkampe opened 4 years ago

thorstenkampe commented 4 years ago

Info

Problem / Steps to reproduce

fzf --preview 'echo {}'

You will see a delay of about three seconds for the preview window to update. This is because fzf runs $Env:SHELL -c <preview-command> which is very expensive for PowerShell. As a workaround, one can unset the environment variable.

On Windows PowerShell does not set $Env:SHELL , so there is no delay.

Is there a rationale why fzf by default forks a new shell to run preview command instead of running the command by itself - which seems to be the default if $Env:SHELL is unset?

isti115 commented 3 years ago

Similar problem, if I have pwsh set as my default shell, and run fzf.vim commands, I get an error message by default, since it cannot execute preview.sh in PowerShell for some reason, even though from pwsh I can execute it without any issues directly.

Thank you very much for the workaround @thorstenkampe, your workaround of unsetting $Env:SHELL fixes this too, but a built in long term solution would be much appreciated!