Move fuzzy history search, Add missing fuzzy warns

Moved zhfind command to fuzzy finding since it relies on sk to be
present. Added some preliminary warnings if sk is not on the system.
This commit is contained in:
Marty Oehme 2019-06-17 18:30:19 +02:00
parent 359de7e1bd
commit 900b949a7a
2 changed files with 7 additions and 3 deletions

View file

@ -11,8 +11,6 @@ fi
alias zhtop="history | awk '{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}' | sort -rn | head" alias zhtop="history | awk '{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}' | sort -rn | head"
# Display timestamped recent command history # Display timestamped recent command history
alias zh="fc -l -d -D" alias zh="fc -l -d -D"
# Display fuzzy-searchable history
alias zhfind="history | tac | fzf -l 20"
# Display your current ip address # Display your current ip address
alias myip="curl -s icanhazip.com" alias myip="curl -s icanhazip.com"

View file

@ -5,11 +5,13 @@
if type sk >/dev/null 2>&1; then if type sk >/dev/null 2>&1; then
alias fzf=sk alias fzf=sk
elif type fzy >/dev/null 2>&1; then elif type fzy >/dev/null 2>&1; then
echo "[WARNING]: fzy found as fuzzy finder - install sk to use full script functionality"
alias fzf=fzy alias fzf=fzy
elif type fzf >/dev/null 2>&1; then elif type fzf >/dev/null 2>&1; then
echo "[WARNING]: fzf found as fuzzy finder - install sk to use full script functionality"
alias fzf=fzf alias fzf=fzf
else else
echo "[WARNING]: No fuzzy finder found - install sk/fzy/fzf to enable functionality" echo "[WARNING]: No fuzzy finder found - install sk to enable functionality"
fi fi
# check for existence of greplikes. If found, substitute fzf with it. # check for existence of greplikes. If found, substitute fzf with it.
@ -25,8 +27,12 @@ else
fi fi
# set up fuzzy file and directory search # set up fuzzy file and directory search
# TODO still uses rifle (from ranger fm) - decide whether to keep it or not
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 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' {}' | xargs rifle"
alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | xargs rifle" alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | xargs rifle"
# Display fuzzy-searchable history
alias zhfind="history | fzf --tac --height 20"