Created
May 16, 2017 18:38
-
-
Save ddrscott/8db948aeb6a7922566bca828f612c258 to your computer and use it in GitHub Desktop.
FZF with highlighted source preview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FZF Stuff | |
export FZF_DEFAULT_COMMAND='ag -g ""' | |
# `highlight` preview options | |
# WARNING: depends on `brew install highlight` | |
export FZF_HIGHLIGHT_PREVIEW_OPTS="--height 100% --preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null' --preview-window=up:40%" | |
# When pressing CTRL-T, only search file names (not directories) | |
# and display highlighted source in preview window | |
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" | |
export FZF_CTRL_T_OPTS="--delimiter '/' --nth=-1 $FZF_HIGHLIGHT_PREVIEW_OPTS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CTRL-T
Demo