Skip to content

Instantly share code, notes, and snippets.

@pando85
Last active January 2, 2022 12:13
Show Gist options
  • Save pando85/519336158db333913600fd14c8dddcf9 to your computer and use it in GitHub Desktop.
Save pando85/519336158db333913600fd14c8dddcf9 to your computer and use it in GitHub Desktop.
fzf.md

fzf

install

config

# Setup fzf
# ---------
if [[ ! "$PATH" == */home/agil/.fzf/bin* ]]; then
  export PATH="$PATH:/home/agil/.fzf/bin"
fi

# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/home/agil/.fzf/shell/completion.zsh" 2> /dev/null

# Key bindings
# ------------
source "/home/agil/.fzf/shell/key-bindings.zsh"

export FZF_DEFAULT_OPTS="--bind 'f2:execute(code {})+abort'"

# CTRL-P
# requirements: highlight
preview(){
  fzf --preview '[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || highlight -O ansi -l {} | head -500'
}

zle -N preview
bindkey '^p' preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment