Rename alias & env setting shell scripts
This commit is contained in:
parent
b9441dc36d
commit
beb5f1c323
9 changed files with 0 additions and 0 deletions
37
.config/shell/rc.d/alias-fuzzy-finding.sh
Normal file
37
.config/shell/rc.d/alias-fuzzy-finding.sh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/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
|
||||
echo "[WARNING]: fzy found as fuzzy finder - install skim to use full script functionality"
|
||||
alias fzf=fzy
|
||||
elif type fzf >/dev/null 2>&1; then
|
||||
echo "[WARNING]: fzf found as fuzzy finder - install skim to use full script functionality"
|
||||
alias fzf=fzf
|
||||
else
|
||||
echo "[WARNING]: No fuzzy finder found - install skim 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 ripgrep/the silver surfer (ag)/ack to enable functionality"
|
||||
fi
|
||||
|
||||
# set up fuzzy file and directory search
|
||||
alias f="fzf -c 'find . -type f' --preview='"'head -$LINES {}'"' | xargs -0 xdg-open"
|
||||
alias F="fzf -c 'find ~ -type f' --preview='"'head -$LINES {}'"' | xargs -0 xdg-open"
|
||||
|
||||
alias d="fzf -c 'find . -type d' --preview='ls --color='always' {}' | cd"
|
||||
alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | cd"
|
||||
|
||||
# Display fuzzy-searchable history
|
||||
alias zhfind="history | fzf --tac --height 20"
|
||||
Loading…
Add table
Add a link
Reference in a new issue