Marty Oehme
359de7e1bd
In preparation for extending the scripting, renamed the script from just being a re-aliasing of fzf. Now, all fuzzy finding logic can reside in this file.
32 lines
1.1 KiB
Bash
32 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
# check for existence of fuzzy finders. If found, substitute fzf with it.
|
|
# order is skim > fzy > fzf > nothing
|
|
if type sk >/dev/null 2>&1; then
|
|
alias fzf=sk
|
|
elif type fzy >/dev/null 2>&1; then
|
|
alias fzf=fzy
|
|
elif type fzf >/dev/null 2>&1; then
|
|
alias fzf=fzf
|
|
else
|
|
echo "[WARNING]: No fuzzy finder found - install sk/fzy/fzf to enable functionality"
|
|
fi
|
|
|
|
# check for existence of greplikes. If found, substitute fzf with it.
|
|
# order is skim > fzy > fzf > nothing
|
|
if type rg >/dev/null 2>&1; then
|
|
alias rg=rg
|
|
elif type ag >/dev/null 2>&1; then
|
|
alias rg=ag
|
|
elif type ack >/dev/null 2>&1; then
|
|
alias rg=ack
|
|
else
|
|
echo "[WARNING]: No grep-like found - install rg/ag/ack to enable functionality"
|
|
fi
|
|
|
|
# set up fuzzy file and directory search
|
|
alias f="fzf -c 'find . -type f' --preview='head -$LINES {}' | xargs rifle"
|
|
alias F="fzf -c 'find ~ -type f' --preview='head -$LINES {}' | xargs rifle"
|
|
|
|
alias d="fzf -c 'find . -type d' --preview='ls --color='always' {}' | xargs rifle"
|
|
alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | xargs rifle"
|