Config

~/.fzf.zsh

Rina Kawakita 2019. 12. 24. 19:07
~/.fzf.zsh
# Setup fzf
# ---------
if [[ ! "$PATH" == */home/nietz/.fzf/bin* ]]; then
  export PATH="$PATH:/home/nietz/.fzf/bin"
fi

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

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

# Environment variables
# ---------------------
# https://github.com/junegunn/fzf#fzf-tmux-script
#export FZF_DEFAULT_COMMAND='ag -g ""'

# Color schemes
# https://github.com/junegunn/fzf/wiki/Color-schemes
# -------------
export FZF_DEFAULT_OPTS='
    --color=bg+:5,fg+:255,info:6,pointer:255,prompt:5,marker:3
    --height 95%
    --reverse
    --border
    --prompt="---● "
'

## Configuring fuzzy completion
# https://github.com/junegunn/fzf/wiki/Configuring-fuzzy-completion

## Configuring shell key bindings
# https://github.com/junegunn/fzf/wiki/Configuring-shell-key-bindings
#
# Preview : CTRL-T
# Using highlight (http://www.andre-simon.de/doku/highlight/en/highlight.html)
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
#export FZF_CTRL_T_OPTS="--select-1 --exit-0"

# Sorting and exact matching : CTRL-R
#export FZF_CTRL_R_OPTS='--sort --exact'
# Full command on preview window
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"