2014-11-30 20:02:34 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-10-23 01:26:55 +00:00
|
|
|
|
2015-10-23 05:56:27 +00:00
|
|
|
set -u
|
|
|
|
|
2023-04-02 14:29:15 +00:00
|
|
|
version=0.39.0
|
2015-10-23 05:56:27 +00:00
|
|
|
auto_completion=
|
|
|
|
key_bindings=
|
2016-04-14 05:51:58 +00:00
|
|
|
update_config=2
|
2017-09-03 02:45:22 +00:00
|
|
|
shells="bash zsh fish"
|
2018-06-01 02:54:58 +00:00
|
|
|
prefix='~/.fzf'
|
|
|
|
prefix_expand=~/.fzf
|
|
|
|
fish_dir=${XDG_CONFIG_HOME:-$HOME/.config}/fish
|
2015-10-23 05:56:27 +00:00
|
|
|
|
|
|
|
help() {
|
|
|
|
cat << EOF
|
|
|
|
usage: $0 [OPTIONS]
|
|
|
|
|
|
|
|
--help Show this message
|
2015-11-12 04:42:56 +00:00
|
|
|
--bin Download fzf binary only; Do not generate ~/.fzf.{bash,zsh}
|
2015-10-23 05:56:27 +00:00
|
|
|
--all Download fzf binary and update configuration files
|
|
|
|
to enable key bindings and fuzzy completion
|
2018-06-01 02:54:58 +00:00
|
|
|
--xdg Generate files under \$XDG_CONFIG_HOME/fzf
|
2015-10-23 05:56:27 +00:00
|
|
|
--[no-]key-bindings Enable/disable key bindings (CTRL-T, CTRL-R, ALT-C)
|
|
|
|
--[no-]completion Enable/disable fuzzy completion (bash & zsh)
|
|
|
|
--[no-]update-rc Whether or not to update shell configuration files
|
|
|
|
|
2017-09-03 02:45:22 +00:00
|
|
|
--no-bash Do not set up bash configuration
|
|
|
|
--no-zsh Do not set up zsh configuration
|
|
|
|
--no-fish Do not set up fish configuration
|
2015-10-23 05:56:27 +00:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2016-03-29 13:28:25 +00:00
|
|
|
for opt in "$@"; do
|
2015-10-23 05:56:27 +00:00
|
|
|
case $opt in
|
|
|
|
--help)
|
|
|
|
help
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--all)
|
|
|
|
auto_completion=1
|
|
|
|
key_bindings=1
|
|
|
|
update_config=1
|
|
|
|
;;
|
2018-06-01 02:54:58 +00:00
|
|
|
--xdg)
|
|
|
|
prefix='"${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf'
|
|
|
|
prefix_expand=${XDG_CONFIG_HOME:-$HOME/.config}/fzf/fzf
|
|
|
|
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/fzf"
|
|
|
|
;;
|
2015-10-23 05:56:27 +00:00
|
|
|
--key-bindings) key_bindings=1 ;;
|
|
|
|
--no-key-bindings) key_bindings=0 ;;
|
|
|
|
--completion) auto_completion=1 ;;
|
|
|
|
--no-completion) auto_completion=0 ;;
|
|
|
|
--update-rc) update_config=1 ;;
|
|
|
|
--no-update-rc) update_config=0 ;;
|
2017-01-07 17:09:31 +00:00
|
|
|
--bin) ;;
|
2017-09-03 02:45:22 +00:00
|
|
|
--no-bash) shells=${shells/bash/} ;;
|
|
|
|
--no-zsh) shells=${shells/zsh/} ;;
|
|
|
|
--no-fish) shells=${shells/fish/} ;;
|
2015-10-23 05:56:27 +00:00
|
|
|
*)
|
|
|
|
echo "unknown option: $opt"
|
|
|
|
help
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-03-29 13:28:25 +00:00
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
2018-09-27 01:15:22 +00:00
|
|
|
fzf_base=$(pwd)
|
|
|
|
fzf_base_esc=$(printf %q "$fzf_base")
|
2013-11-19 16:29:36 +00:00
|
|
|
|
2015-01-04 05:29:42 +00:00
|
|
|
ask() {
|
2017-08-31 17:43:44 +00:00
|
|
|
while true; do
|
|
|
|
read -p "$1 ([y]/n) " -r
|
2018-01-13 18:19:33 +00:00
|
|
|
REPLY=${REPLY:-"y"}
|
2017-08-31 17:43:44 +00:00
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
return 1
|
|
|
|
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
2015-01-04 05:29:42 +00:00
|
|
|
}
|
|
|
|
|
2015-01-05 03:21:26 +00:00
|
|
|
check_binary() {
|
2015-01-07 11:08:05 +00:00
|
|
|
echo -n " - Checking fzf executable ... "
|
2015-08-19 10:42:06 +00:00
|
|
|
local output
|
2019-03-05 05:44:29 +00:00
|
|
|
output=$("$fzf_base"/bin/fzf --version 2>&1)
|
2015-08-19 10:42:06 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error: $output"
|
|
|
|
binary_error="Invalid binary"
|
|
|
|
else
|
2019-03-05 05:44:29 +00:00
|
|
|
output=${output/ */}
|
|
|
|
if [ "$version" != "$output" ]; then
|
|
|
|
echo "$output != $version"
|
|
|
|
binary_error="Invalid version"
|
|
|
|
else
|
|
|
|
echo "$output"
|
|
|
|
binary_error=""
|
|
|
|
return 0
|
|
|
|
fi
|
2015-01-05 03:21:26 +00:00
|
|
|
fi
|
2015-08-19 10:42:06 +00:00
|
|
|
rm -f "$fzf_base"/bin/fzf
|
|
|
|
return 1
|
2015-01-05 03:21:26 +00:00
|
|
|
}
|
|
|
|
|
2016-02-21 13:11:28 +00:00
|
|
|
link_fzf_in_path() {
|
2016-03-29 13:28:25 +00:00
|
|
|
if which_fzf="$(command -v fzf)"; then
|
2016-02-21 13:11:28 +00:00
|
|
|
echo " - Found in \$PATH"
|
2019-03-05 05:45:29 +00:00
|
|
|
echo " - Creating symlink: bin/fzf -> $which_fzf"
|
2016-02-21 13:11:28 +00:00
|
|
|
(cd "$fzf_base"/bin && rm -f fzf && ln -sf "$which_fzf" fzf)
|
|
|
|
check_binary && return
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2016-07-03 16:40:24 +00:00
|
|
|
try_curl() {
|
2017-06-03 10:47:53 +00:00
|
|
|
command -v curl > /dev/null &&
|
2020-10-26 16:46:43 +00:00
|
|
|
if [[ $1 =~ tar.gz$ ]]; then
|
2017-06-03 10:47:53 +00:00
|
|
|
curl -fL $1 | tar -xzf -
|
|
|
|
else
|
|
|
|
local temp=${TMPDIR:-/tmp}/fzf.zip
|
|
|
|
curl -fLo "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
|
|
|
|
fi
|
2016-07-03 16:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try_wget() {
|
2017-06-03 10:47:53 +00:00
|
|
|
command -v wget > /dev/null &&
|
2020-10-26 16:46:43 +00:00
|
|
|
if [[ $1 =~ tar.gz$ ]]; then
|
2017-06-03 10:47:53 +00:00
|
|
|
wget -O - $1 | tar -xzf -
|
|
|
|
else
|
|
|
|
local temp=${TMPDIR:-/tmp}/fzf.zip
|
|
|
|
wget -O "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
|
|
|
|
fi
|
2016-07-03 16:40:24 +00:00
|
|
|
}
|
|
|
|
|
2015-01-01 19:49:30 +00:00
|
|
|
download() {
|
2015-01-13 14:46:38 +00:00
|
|
|
echo "Downloading bin/fzf ..."
|
2020-10-26 16:46:43 +00:00
|
|
|
if [ -x "$fzf_base"/bin/fzf ]; then
|
|
|
|
echo " - Already exists"
|
|
|
|
check_binary && return
|
2015-01-04 05:29:42 +00:00
|
|
|
fi
|
2020-10-26 16:46:43 +00:00
|
|
|
link_fzf_in_path && return
|
2015-01-03 17:42:58 +00:00
|
|
|
mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin
|
|
|
|
if [ $? -ne 0 ]; then
|
2015-01-05 03:21:26 +00:00
|
|
|
binary_error="Failed to create bin directory"
|
|
|
|
return
|
2015-01-03 17:42:58 +00:00
|
|
|
fi
|
|
|
|
|
2017-01-07 17:09:31 +00:00
|
|
|
local url
|
2020-10-26 16:46:43 +00:00
|
|
|
url=https://github.com/junegunn/fzf/releases/download/$version/${1}
|
2016-07-04 04:00:30 +00:00
|
|
|
set -o pipefail
|
2016-07-03 16:40:24 +00:00
|
|
|
if ! (try_curl $url || try_wget $url); then
|
2016-07-04 04:05:26 +00:00
|
|
|
set +o pipefail
|
2016-07-03 16:40:24 +00:00
|
|
|
binary_error="Failed to download with curl and wget"
|
2015-01-05 03:21:26 +00:00
|
|
|
return
|
2015-01-03 17:42:58 +00:00
|
|
|
fi
|
2016-07-04 04:00:30 +00:00
|
|
|
set +o pipefail
|
2015-01-03 17:42:58 +00:00
|
|
|
|
2017-02-05 07:17:54 +00:00
|
|
|
if [ ! -f fzf ]; then
|
2015-01-05 03:21:26 +00:00
|
|
|
binary_error="Failed to download ${1}"
|
|
|
|
return
|
2014-06-20 16:43:25 +00:00
|
|
|
fi
|
2015-01-03 17:42:58 +00:00
|
|
|
|
2017-02-05 07:17:54 +00:00
|
|
|
chmod +x fzf && check_binary
|
2015-01-01 19:49:30 +00:00
|
|
|
}
|
|
|
|
|
2015-01-03 17:42:58 +00:00
|
|
|
# Try to download binary executable
|
2015-01-04 16:25:54 +00:00
|
|
|
archi=$(uname -sm)
|
2015-01-05 03:21:26 +00:00
|
|
|
binary_available=1
|
|
|
|
binary_error=""
|
2015-01-05 17:04:06 +00:00
|
|
|
case "$archi" in
|
2022-11-11 15:57:33 +00:00
|
|
|
Darwin\ arm64) download fzf-$version-darwin_arm64.zip ;;
|
|
|
|
Darwin\ x86_64) download fzf-$version-darwin_amd64.zip ;;
|
|
|
|
Linux\ armv5*) download fzf-$version-linux_armv5.tar.gz ;;
|
|
|
|
Linux\ armv6*) download fzf-$version-linux_armv6.tar.gz ;;
|
|
|
|
Linux\ armv7*) download fzf-$version-linux_armv7.tar.gz ;;
|
|
|
|
Linux\ armv8*) download fzf-$version-linux_arm64.tar.gz ;;
|
|
|
|
Linux\ aarch64*) download fzf-$version-linux_arm64.tar.gz ;;
|
|
|
|
Linux\ loongarch64) download fzf-$version-linux_loong64.tar.gz ;;
|
2022-11-30 12:20:05 +00:00
|
|
|
Linux\ ppc64le) download fzf-$version-linux_ppc64le.tar.gz ;;
|
2022-11-11 15:57:33 +00:00
|
|
|
Linux\ *64) download fzf-$version-linux_amd64.tar.gz ;;
|
2023-02-22 04:32:52 +00:00
|
|
|
Linux\ s390x) download fzf-$version-linux_s390x.tar.gz ;;
|
2022-11-11 15:57:33 +00:00
|
|
|
FreeBSD\ *64) download fzf-$version-freebsd_amd64.tar.gz ;;
|
|
|
|
OpenBSD\ *64) download fzf-$version-openbsd_amd64.tar.gz ;;
|
|
|
|
CYGWIN*\ *64) download fzf-$version-windows_amd64.zip ;;
|
|
|
|
MINGW*\ *64) download fzf-$version-windows_amd64.zip ;;
|
|
|
|
MSYS*\ *64) download fzf-$version-windows_amd64.zip ;;
|
|
|
|
Windows*\ *64) download fzf-$version-windows_amd64.zip ;;
|
|
|
|
*) binary_available=0 binary_error=1 ;;
|
2015-01-05 17:04:06 +00:00
|
|
|
esac
|
2015-01-03 17:42:58 +00:00
|
|
|
|
2016-02-21 13:11:28 +00:00
|
|
|
cd "$fzf_base"
|
|
|
|
if [ -n "$binary_error" ]; then
|
|
|
|
if [ $binary_available -eq 0 ]; then
|
|
|
|
echo "No prebuilt binary for $archi ..."
|
2016-07-15 15:36:35 +00:00
|
|
|
else
|
|
|
|
echo " - $binary_error !!!"
|
|
|
|
fi
|
|
|
|
if command -v go > /dev/null; then
|
2017-06-02 09:19:21 +00:00
|
|
|
echo -n "Building binary (go get -u github.com/junegunn/fzf) ... "
|
2016-07-15 15:36:35 +00:00
|
|
|
if [ -z "${GOPATH-}" ]; then
|
|
|
|
export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"
|
|
|
|
mkdir -p "$GOPATH"
|
|
|
|
fi
|
2020-10-28 06:56:05 +00:00
|
|
|
if go get -ldflags "-s -w -X main.version=$version -X main.revision=go-get" github.com/junegunn/fzf; then
|
2016-07-15 15:36:35 +00:00
|
|
|
echo "OK"
|
|
|
|
cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
|
2016-02-21 13:11:28 +00:00
|
|
|
else
|
2017-02-06 12:06:12 +00:00
|
|
|
echo "Failed to build binary. Installation failed."
|
|
|
|
exit 1
|
2016-02-21 13:11:28 +00:00
|
|
|
fi
|
|
|
|
else
|
2017-02-06 12:06:12 +00:00
|
|
|
echo "go executable not found. Installation failed."
|
|
|
|
exit 1
|
2016-02-21 13:11:28 +00:00
|
|
|
fi
|
2013-11-19 16:29:36 +00:00
|
|
|
fi
|
|
|
|
|
2015-04-16 12:58:41 +00:00
|
|
|
[[ "$*" =~ "--bin" ]] && exit 0
|
|
|
|
|
2017-09-03 02:45:22 +00:00
|
|
|
for s in $shells; do
|
|
|
|
if ! command -v "$s" > /dev/null; then
|
|
|
|
shells=${shells/$s/}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ${#shells} -lt 3 ]]; then
|
|
|
|
echo "No shell configuration to be updated."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2013-11-19 16:29:36 +00:00
|
|
|
# Auto-completion
|
2015-10-23 05:56:27 +00:00
|
|
|
if [ -z "$auto_completion" ]; then
|
|
|
|
ask "Do you want to enable fuzzy auto-completion?"
|
|
|
|
auto_completion=$?
|
|
|
|
fi
|
2013-11-19 16:29:36 +00:00
|
|
|
|
2013-12-21 15:18:41 +00:00
|
|
|
# Key-bindings
|
2015-10-23 05:56:27 +00:00
|
|
|
if [ -z "$key_bindings" ]; then
|
|
|
|
ask "Do you want to enable key bindings?"
|
|
|
|
key_bindings=$?
|
|
|
|
fi
|
2013-12-21 15:18:41 +00:00
|
|
|
|
2013-11-19 16:29:36 +00:00
|
|
|
echo
|
2016-03-29 13:28:25 +00:00
|
|
|
for shell in $shells; do
|
2017-09-03 02:45:22 +00:00
|
|
|
[[ "$shell" = fish ]] && continue
|
2018-06-01 02:54:58 +00:00
|
|
|
src=${prefix_expand}.${shell}
|
|
|
|
echo -n "Generate $src ... "
|
2013-11-19 16:29:36 +00:00
|
|
|
|
2015-10-01 19:18:10 +00:00
|
|
|
fzf_completion="[[ \$- == *i* ]] && source \"$fzf_base/shell/completion.${shell}\" 2> /dev/null"
|
2015-10-23 05:56:27 +00:00
|
|
|
if [ $auto_completion -eq 0 ]; then
|
2013-11-26 10:01:01 +00:00
|
|
|
fzf_completion="# $fzf_completion"
|
2013-11-19 16:29:36 +00:00
|
|
|
fi
|
|
|
|
|
2015-03-13 04:08:42 +00:00
|
|
|
fzf_key_bindings="source \"$fzf_base/shell/key-bindings.${shell}\""
|
2015-10-23 05:56:27 +00:00
|
|
|
if [ $key_bindings -eq 0 ]; then
|
2015-03-13 04:08:42 +00:00
|
|
|
fzf_key_bindings="# $fzf_key_bindings"
|
|
|
|
fi
|
2015-01-12 17:39:00 +00:00
|
|
|
|
2018-06-01 02:54:58 +00:00
|
|
|
cat > "$src" << EOF
|
2015-01-12 17:39:00 +00:00
|
|
|
# Setup fzf
|
|
|
|
# ---------
|
2018-09-27 01:15:22 +00:00
|
|
|
if [[ ! "\$PATH" == *$fzf_base_esc/bin* ]]; then
|
2022-06-24 07:53:51 +00:00
|
|
|
PATH="\${PATH:+\${PATH}:}$fzf_base/bin"
|
2015-01-01 19:49:30 +00:00
|
|
|
fi
|
2013-12-21 15:18:41 +00:00
|
|
|
|
|
|
|
# Auto-completion
|
|
|
|
# ---------------
|
2014-05-03 15:49:29 +00:00
|
|
|
$fzf_completion
|
2013-11-26 10:01:01 +00:00
|
|
|
|
2013-12-21 15:18:41 +00:00
|
|
|
# Key bindings
|
|
|
|
# ------------
|
2015-03-13 04:08:42 +00:00
|
|
|
$fzf_key_bindings
|
|
|
|
EOF
|
2013-11-26 10:01:01 +00:00
|
|
|
echo "OK"
|
|
|
|
done
|
|
|
|
|
2014-05-02 02:27:32 +00:00
|
|
|
# fish
|
2017-09-03 02:45:22 +00:00
|
|
|
if [[ "$shells" =~ fish ]]; then
|
2015-03-13 04:08:42 +00:00
|
|
|
echo -n "Update fish_user_paths ... "
|
|
|
|
fish << EOF
|
2018-09-27 01:15:22 +00:00
|
|
|
echo \$fish_user_paths | \grep "$fzf_base"/bin > /dev/null
|
|
|
|
or set --universal fish_user_paths \$fish_user_paths "$fzf_base"/bin
|
2015-03-13 04:08:42 +00:00
|
|
|
EOF
|
|
|
|
[ $? -eq 0 ] && echo "OK" || echo "Failed"
|
|
|
|
|
2018-06-01 02:54:58 +00:00
|
|
|
mkdir -p "${fish_dir}/functions"
|
|
|
|
fish_binding="${fish_dir}/functions/fzf_key_bindings.fish"
|
2015-10-23 05:56:27 +00:00
|
|
|
if [ $key_bindings -ne 0 ]; then
|
|
|
|
echo -n "Symlink $fish_binding ... "
|
|
|
|
ln -sf "$fzf_base/shell/key-bindings.fish" \
|
|
|
|
"$fish_binding" && echo "OK" || echo "Failed"
|
|
|
|
else
|
|
|
|
echo -n "Removing $fish_binding ... "
|
|
|
|
rm -f "$fish_binding"
|
|
|
|
echo "OK"
|
2014-05-02 02:27:32 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
append_line() {
|
2015-09-24 01:51:05 +00:00
|
|
|
set -e
|
2015-10-23 05:56:27 +00:00
|
|
|
|
2016-04-14 05:51:58 +00:00
|
|
|
local update line file pat lno
|
|
|
|
update="$1"
|
2015-10-23 05:56:27 +00:00
|
|
|
line="$2"
|
|
|
|
file="$3"
|
|
|
|
pat="${4:-}"
|
2017-09-11 00:18:26 +00:00
|
|
|
lno=""
|
2015-10-23 05:56:27 +00:00
|
|
|
|
|
|
|
echo "Update $file:"
|
|
|
|
echo " - $line"
|
2017-09-11 00:18:26 +00:00
|
|
|
if [ -f "$file" ]; then
|
|
|
|
if [ $# -lt 4 ]; then
|
|
|
|
lno=$(\grep -nF "$line" "$file" | sed 's/:.*//' | tr '\n' ' ')
|
|
|
|
else
|
|
|
|
lno=$(\grep -nF "$pat" "$file" | sed 's/:.*//' | tr '\n' ' ')
|
|
|
|
fi
|
2014-09-18 03:55:28 +00:00
|
|
|
fi
|
2015-10-23 05:56:27 +00:00
|
|
|
if [ -n "$lno" ]; then
|
|
|
|
echo " - Already exists: line #$lno"
|
2013-11-26 10:01:01 +00:00
|
|
|
else
|
2016-04-14 05:51:58 +00:00
|
|
|
if [ $update -eq 1 ]; then
|
2017-09-11 00:18:26 +00:00
|
|
|
[ -f "$file" ] && echo >> "$file"
|
2015-10-23 05:56:27 +00:00
|
|
|
echo "$line" >> "$file"
|
|
|
|
echo " + Added"
|
|
|
|
else
|
|
|
|
echo " ~ Skipped"
|
|
|
|
fi
|
2013-11-19 16:29:36 +00:00
|
|
|
fi
|
|
|
|
echo
|
2015-09-24 01:51:05 +00:00
|
|
|
set +e
|
2014-05-02 02:27:32 +00:00
|
|
|
}
|
|
|
|
|
2017-04-27 16:57:38 +00:00
|
|
|
create_file() {
|
|
|
|
local file="$1"
|
|
|
|
shift
|
|
|
|
echo "Create $file:"
|
|
|
|
for line in "$@"; do
|
|
|
|
echo " $line"
|
|
|
|
echo "$line" >> "$file"
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2016-04-14 05:51:58 +00:00
|
|
|
if [ $update_config -eq 2 ]; then
|
|
|
|
echo
|
|
|
|
ask "Do you want to update your shell configuration files?"
|
|
|
|
update_config=$?
|
|
|
|
fi
|
2014-05-02 02:27:32 +00:00
|
|
|
echo
|
2016-03-29 13:28:25 +00:00
|
|
|
for shell in $shells; do
|
2017-09-03 02:45:22 +00:00
|
|
|
[[ "$shell" = fish ]] && continue
|
2015-11-08 16:48:55 +00:00
|
|
|
[ $shell = zsh ] && dest=${ZDOTDIR:-~}/.zshrc || dest=~/.bashrc
|
2018-06-01 02:54:58 +00:00
|
|
|
append_line $update_config "[ -f ${prefix}.${shell} ] && source ${prefix}.${shell}" "$dest" "${prefix}.${shell}"
|
2013-11-19 16:29:36 +00:00
|
|
|
done
|
|
|
|
|
2017-09-03 02:45:22 +00:00
|
|
|
if [ $key_bindings -eq 1 ] && [[ "$shells" =~ fish ]]; then
|
2018-06-01 02:54:58 +00:00
|
|
|
bind_file="${fish_dir}/functions/fish_user_key_bindings.fish"
|
2017-04-27 16:57:38 +00:00
|
|
|
if [ ! -e "$bind_file" ]; then
|
|
|
|
create_file "$bind_file" \
|
|
|
|
'function fish_user_key_bindings' \
|
|
|
|
' fzf_key_bindings' \
|
|
|
|
'end'
|
|
|
|
else
|
|
|
|
append_line $update_config "fzf_key_bindings" "$bind_file"
|
|
|
|
fi
|
2014-05-02 02:27:32 +00:00
|
|
|
fi
|
|
|
|
|
2016-04-14 05:51:58 +00:00
|
|
|
if [ $update_config -eq 1 ]; then
|
|
|
|
echo 'Finished. Restart your shell or reload config file.'
|
2020-04-17 12:51:16 +00:00
|
|
|
if [[ "$shells" =~ bash ]]; then
|
|
|
|
echo -n ' source ~/.bashrc # bash'
|
|
|
|
[[ "$archi" =~ Darwin ]] && echo -n ' (.bashrc should be loaded from .bash_profile)'
|
|
|
|
echo
|
|
|
|
fi
|
2017-09-03 02:45:22 +00:00
|
|
|
[[ "$shells" =~ zsh ]] && echo " source ${ZDOTDIR:-~}/.zshrc # zsh"
|
|
|
|
[[ "$shells" =~ fish ]] && [ $key_bindings -eq 1 ] && echo ' fzf_key_bindings # fish'
|
2016-04-14 05:51:58 +00:00
|
|
|
echo
|
|
|
|
echo 'Use uninstall script to remove fzf.'
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
echo 'For more information, see: https://github.com/junegunn/fzf'
|