From e929b85669de9a27de97a0749155e42a645f9cf8 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Sat, 22 Apr 2023 14:56:34 +0300 Subject: [PATCH] brew: fzf --- Brewfile | 2 ++ config/exports-shell | 10 ++++++++++ config/fzf/fzf.bash | 13 +++++++++++++ config/fzf/fzf.zsh | 13 +++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 config/fzf/fzf.bash create mode 100644 config/fzf/fzf.zsh diff --git a/Brewfile b/Brewfile index 65bda67..551763d 100644 --- a/Brewfile +++ b/Brewfile @@ -73,6 +73,8 @@ brew "fd" brew "freetds" # Monitor a directory for changes and run a shell command brew "fswatch" +# Command-line fuzzy finder written in Go +brew "fzf" # Disk usage analyzer with console interface written in Go brew "gdu", link: false # GitHub command-line tool diff --git a/config/exports-shell b/config/exports-shell index 7b8afc2..dfa9f9a 100755 --- a/config/exports-shell +++ b/config/exports-shell @@ -49,4 +49,14 @@ if [ "$SHELL" = "$(which zsh)" ]; then export HISTFILE="$XDG_STATE_HOME/zsh/history" zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache" zstyle ':completion:*' list-colors "$LS_COLORS" + + # fzf + [ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh ] \ + && source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh +fi + +# If we are using bash +if [ "$SHELL" = "$(which bash)" ]; then + [ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ] \ + && source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash fi diff --git a/config/fzf/fzf.bash b/config/fzf/fzf.bash new file mode 100644 index 0000000..ebf72a7 --- /dev/null +++ b/config/fzf/fzf.bash @@ -0,0 +1,13 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */opt/homebrew/opt/fzf/bin* ]]; then + PATH="${PATH:+${PATH}:}/opt/homebrew/opt/fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.bash" 2> /dev/null + +# Key bindings +# ------------ +source "/opt/homebrew/opt/fzf/shell/key-bindings.bash" diff --git a/config/fzf/fzf.zsh b/config/fzf/fzf.zsh new file mode 100644 index 0000000..be24395 --- /dev/null +++ b/config/fzf/fzf.zsh @@ -0,0 +1,13 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */opt/homebrew/opt/fzf/bin* ]]; then + PATH="${PATH:+${PATH}:}/opt/homebrew/opt/fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null + +# Key bindings +# ------------ +source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh"