Created
April 18, 2019 22:36
-
-
Save samoshkin/efc6672b13b4244f000cfc4b0c4d6125 to your computer and use it in GitHub Desktop.
fzf configuration snippet
This file contains 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
# Exclude those directories even if not listed in .gitignore, or if .gitignore is missing | |
FD_OPTIONS="--follow --exclude .git --exclude node_modules" | |
# Change behavior of fzf dialogue | |
export FZF_DEFAULT_OPTS="--no-mouse --height 50% -1 --reverse --multi --inline-info --preview='[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (bat --style=numbers --color=always {} || cat {}) 2> /dev/null | head -300' --preview-window='right:hidden:wrap' --bind='f3:execute(bat --style=numbers {} || less -f {}),f2:toggle-preview,ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-a:select-all+accept,ctrl-y:execute-silent(echo {+} | pbcopy)'" | |
# Change find backend | |
# Use 'git ls-files' when inside GIT repo, or fd otherwise | |
export FZF_DEFAULT_COMMAND="git ls-files --cached --others --exclude-standard | fd --type f --type l $FD_OPTIONS" | |
# Find commands for "Ctrl+T" and "Opt+C" shortcuts | |
export FZF_CTRL_T_COMMAND="fd $FD_OPTIONS" | |
export FZF_ALT_C_COMMAND="fd --type d $FD_OPTIONS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment