From 900b949a7a3d5739859d3c87eb3bb5832d145081 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 17 Jun 2019 18:30:19 +0200 Subject: [PATCH] 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. --- .config/shell/rc.d/base-aliases.sh | 2 -- .config/shell/rc.d/fuzzy-finding.sh | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.config/shell/rc.d/base-aliases.sh b/.config/shell/rc.d/base-aliases.sh index f3b7617..970cd4a 100644 --- a/.config/shell/rc.d/base-aliases.sh +++ b/.config/shell/rc.d/base-aliases.sh @@ -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" # Display timestamped recent command history alias zh="fc -l -d -D" -# Display fuzzy-searchable history -alias zhfind="history | tac | fzf -l 20" # Display your current ip address alias myip="curl -s icanhazip.com" diff --git a/.config/shell/rc.d/fuzzy-finding.sh b/.config/shell/rc.d/fuzzy-finding.sh index b60f260..3cf4dd2 100644 --- a/.config/shell/rc.d/fuzzy-finding.sh +++ b/.config/shell/rc.d/fuzzy-finding.sh @@ -5,11 +5,13 @@ 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 sk to use full script functionality" alias fzf=fzy 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 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 # check for existence of greplikes. If found, substitute fzf with it. @@ -25,8 +27,12 @@ else fi # 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 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" + +# Display fuzzy-searchable history +alias zhfind="history | fzf --tac --height 20"