32 lines
956 B
Bash
Executable file
32 lines
956 B
Bash
Executable file
# Setup fzf
|
|
# ---------
|
|
# Get the path to fzf installed by Nix or from a general location
|
|
FZF_PATH="$(command -v fzf | xargs dirname)"
|
|
|
|
# Ensure the fzf binary is in the PATH (if not already added)
|
|
if [[ ! "$PATH" == *"$FZF_PATH/bin"* ]]; then
|
|
PATH="${PATH:+${PATH}:}$FZF_PATH/bin"
|
|
fi
|
|
|
|
# Auto-completion
|
|
# ---------------
|
|
if [[ -f "$FZF_PATH/shell/completion.bash" ]]; then
|
|
source "$FZF_PATH/shell/completion.bash"
|
|
fi
|
|
|
|
# Key bindings
|
|
# ------------
|
|
if [[ -f "$FZF_PATH/shell/key-bindings.bash" ]]; then
|
|
source "$FZF_PATH/shell/key-bindings.bash"
|
|
fi
|
|
|
|
# Check for WSL and ensure compatibility
|
|
if grep -q Microsoft /proc/version; then
|
|
# WSL-specific path handling (if needed)
|
|
if [[ -f "/mnt/c/Program Files/fzf/shell/completion.bash" ]]; then
|
|
source "/mnt/c/Program Files/fzf/shell/completion.bash"
|
|
fi
|
|
if [[ -f "/mnt/c/Program Files/fzf/shell/key-bindings.bash" ]]; then
|
|
source "/mnt/c/Program Files/fzf/shell/key-bindings.bash"
|
|
fi
|
|
fi
|