Is it possible to use fzf (command line fuzzy finder) with windows 10 git-bash?
Asked Answered
K

3

16

I downloaded the .exe file and placed it into my PATH variable. fzf seems to work in command prompt. But I would like to use it in git-bash. When i use fzf in git-bash it seems to start but nothing happens.

Any advice would be helpful. I'm trying to save myself some keystrokes.

Kailey answered 21/5, 2020 at 21:1 Comment(0)
R
9

Yes it is.

I just downloaded fzf.exe from fzf-bin, launched bash.exe, and typed ./fzf.exe

But for that, I use a simplified PATH first:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%

With that PATH, fzf just works.

fzf in bash


2024: baywet notes in the comments that winget allows to install fzf with:

winget install junegunn.fzf
Reverential answered 10/9, 2020 at 18:28 Comment(10)
Thanks, to then integrate it with bash's CTRL+R history search is there a simpler way than cloning the fzf repo to ~/.fzf and then running ~/.fzf/install?Goglet
@SamHasler you could only curl that single file curl -o- https://raw.githubusercontent.com/junegunn/fzf/master/install|bash, as in here: https://mcmap.net/q/751134/-install-script-curl-39-ed-from-githubReverential
$ set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ > bash: C:WINDOWS: command not found bash: C:WINDOWSSystem32Wbem: command not found bash: C:WINDOWSSystem32WindowsPowerShellv1.0: command not found $ set GH=C:\myprog\Git $ set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH% bash: fg: %GH%usrbin: no such job bash: fg: %GH%mingw64bin: no such job bash: fg: %GH%mingw64libexecgit-core: no such job bash: fg: %PATH%: no such job Only setting GH worked for me. Any ideas what went wrong?Lully
@Tablut Those set commands are meant to be executed in a CMD session. Then, from that same CMD session, you type bash to enter a bash session.Reverential
Is what file do we add the three set statements?Nob
@Nob They are not in a file. They are typed and executed directly in the CMD, in order to change the PATH for that CMD session.Reverential
The repository has been moved as fzf only. This is the updated link (github.com/junegunn/fzf/releases) for releases.Trombley
@CompaqLE2202x Thank you for the feedback. I have updated the answer accordingly.Reverential
if you have winget / the windows app installer installed. You can install the tool with winget install --id junegunn.fzf it'll take care of setting the path, and you'll be able to get updates simply.Veradia
@Veradia Good point, thank you for your feedback. I have included your comment in the answer for more visibility.Reverential
C
2

I know this question was a while ago, but hopefully I can be of some use for any new readers trying to get fuzzy finder working, in git-bash

For whatever reason, I had tried the package from the GitHub repo @VonC shared and the new repo linked thereof and neither package executed in terminal as expected - Only thing could do was fzf --help


As you know git-bash is based on MSYS2, and they have pacman to install packages and a package list can also be found here https://packages.msys2.org/package/ including a fuzzy finder, however not fzf, but fzy

To get the Windows compatible file, go straight to 'File', not the upstream URL and within the downloaded compressed file you will find the .exe

Move that .exe to your git-bash /usr/bin and either rename fzy.exe to fzf.exe or bash alias fzf to execute fzy

Colubrid answered 23/2, 2021 at 16:2 Comment(0)
N
0

Put the fzf.exe file in the cmd folder under Git. So for me it would be C:\Users\<<username>>\AppData\Local\Programs\Git\cmd

Nob answered 17/5, 2023 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.