From 8e85e8b074fa1d04cdfd64c41bc57ae313c4749e Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Thu, 17 Dec 2020 10:52:53 -0800 Subject: [PATCH] Add fzf package --- fzf/.local/bin/install-fzf-home | 38 ++++++++++++++++++++++++++++++++ {vim => fzf}/.vim/plug.d/fzf.vim | 0 2 files changed, 38 insertions(+) create mode 100755 fzf/.local/bin/install-fzf-home rename {vim => fzf}/.vim/plug.d/fzf.vim (100%) diff --git a/fzf/.local/bin/install-fzf-home b/fzf/.local/bin/install-fzf-home new file mode 100755 index 0000000..7f7e8eb --- /dev/null +++ b/fzf/.local/bin/install-fzf-home @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +APP=fzf +VERSION=${VERSION:-0.24.4} +DATA_DIR="${XDG_DATA_HOME}/buddy-up/apps" +DEST_DIR="${DATA_DIR}/${APP}/${VERSION}" + +OS= +ARCH= +case $(uname -s) in + Linux*) OS=linux;; + Darwin*) OS=darwin;; + *) >&2 echo "unsupported os"; return; +esac + +case $(uname -m) in + x86_64*) ARCH=amd64;; + *) >&2 echo "unsupported architecture"; exit 1;; +esac + +URL="https://github.com/junegunn/fzf/releases/download/${VERSION}/fzf-${VERSION}-${OS}_${ARCH}.tar.gz" + +TMP_DIR= +if [[ ! -d "${DEST_DIR}" ]] ; then + TMP_DIR=$(mktemp --directory) + TAR_GZ="${TMP_DIR}/release.tar.gz" + curl --location --silent --output "${TAR_GZ}" "${URL}" + mkdir -p "${DEST_DIR}" + tar xzf "${TAR_GZ}" --directory "${DEST_DIR}" + rm -rf "${TMP_DIR}" +fi + +cd "${DATA_DIR}/${APP}" || exit +[[ -s current ]] && unlink current +ln -s "${VERSION}" current + +cd "${XDG_BIN_HOME}" || exit +[[ -L "${APP}" ]] || ln --symbolic "${DATA_DIR}/${APP}/current/${APP}" ${APP} diff --git a/vim/.vim/plug.d/fzf.vim b/fzf/.vim/plug.d/fzf.vim similarity index 100% rename from vim/.vim/plug.d/fzf.vim rename to fzf/.vim/plug.d/fzf.vim