-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fzf not working in git bash windows 10 #2798
Comments
I saw that behavior on the default git bash terminal. I'd suggest you to use a different terminal like |
I am also experiencing this issue. EDIT: I now realize this is a know behavior: https://github.com/junegunn/fzf/wiki/Cygwin |
I found the solution, fzf not wroking on git bash winpty fzf or in .bashrc file for git bash (idk if it exist or not) alias fzf ="winpty fzf" |
I am working on this issue in MSYS2 + mintty environment. winpty solves the problem when stdin is a tty, but hangs when stdin is a pipe (same as #2255). I am trying the following wrappers and so far they are working fine in my environment. fzf_winpty=~/.fzf/bin/fzf-winpty
cat >"${fzf_winpty}" <<'EOF'
#!/usr/bin/env bash
set -eo pipefail
prefix="$(basename "${BASH_SOURCE:-$0}")-${UID:-$(id -u)}"
tmpdir=$(mktemp -dp "${TMPDIR:-/tmp}" "${prefix}.XXXXX")
trap "rm -rf -- '${tmpdir}'" EXIT
args=
[[ $# -ge 1 ]] && args=$(printf ' %q' "$@")
if [[ -t 0 ]]; then
winpty </dev/tty >/dev/tty -- bash -c \
"command fzf${args} >'${tmpdir}'/output"
cat "${tmpdir}"/output
else
cat - >"${tmpdir}"/input
winpty </dev/tty >/dev/tty -- bash -c \
"command fzf${args} <'${tmpdir}'/input >'${tmpdir}'/output"
cat "${tmpdir}"/output
fi
EOF
chmod +x "${fzf_winpty}"
fzf() { "${fzf_winpty}" "$@" ; } |
Thank you @knutze. @junegunn: Could a check such as if [ "$TERM_PROGRAM" = "mintty" ]; then fzf() {
OLD_SHELL_OPTS=$(set +o)
set -eo pipefail
# Generate a unique temporary directory based on the script name and user ID
prefix="$(basename "${BASH_SOURCE:-$0}")-${UID:-$(id -u)}"
tmpdir=$(mktemp -dp "${TMPDIR:-/tmp}" "${prefix}.XXXXX")
trap "rm -rf -- '${tmpdir}'; eval \"$OLD_SHELL_OPTS\"" EXIT
# Prepare arguments for fzf command
args=
[[ $# -ge 1 ]] && args=$(printf ' %q' "$@")
# Check if standard input is a terminal
if [[ -t 0 ]]; then
# If it is, run fzf directly using winpty and output to a temporary file
winpty </dev/tty >/dev/tty -- bash -c \
"command fzf${args} >'${tmpdir}/output'"
cat "${tmpdir}/output" else
# If standard input is not a terminal, read from standard input to a
# temporary file
cat - >"${tmpdir}/input"
# Then run fzf using winpty with input redirection
winpty </dev/tty >/dev/tty -- bash -c \
"command fzf${args} <'${tmpdir}/input' >'${tmpdir}/output'"
cat "${tmpdir}/output" fi
}
fi not be added to the shell setup of |
Script provided by @knutze Addresses junegunn#2798
man fzf
)Info
Problem / Steps to reproduce
Installation via scoop.
scoop install fzf
It's working out of box for cmd/powershell but on git bash all I can do is fzf --help
When i use fzf in git-bash it seems to start but nothing happens.
The text was updated successfully, but these errors were encountered: