summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-01-05 10:19:48 +0200
committerDylan Araps <dylan.araps@gmail.com>2019-01-05 10:19:48 +0200
commit1e8dff64dd839834ebba9a9dc523387ac9269fb4 (patch)
tree9279f7439a8f67153c7020bc7758e19fa61d4392
parentb31e9259deefb71e57b08aa55dbd8ef786c07bbd (diff)
instant as you type search
-rwxr-xr-xfff10
1 files changed, 8 insertions, 2 deletions
diff --git a/fff b/fff
index 06b3896..48222cd 100755
--- a/fff
+++ b/fff
@@ -57,8 +57,14 @@ prompt() {
mv "${f[l]}" "$FFF_TRASH"; ((l>0?l--:l)); } ;;
n) read -rp "mkdir: "; [[ $REPLY ]] && mkdir -p "$PWD/$REPLY" ;;
f) read -rp "mkfile: "; [[ $REPLY ]] && : > "$PWD/$REPLY" ;;
- /) g="$PWD"; read -rp /; [[ $REPLY ]] && f=("$PWD"/*"$REPLY"*)
- l=0; refresh; f_print; return
+ /)
+ g="$PWD"; read -n 1 -rp $'\e[2K\r'"/$sr2" sr
+ [[ $sr != $'\e' ]] && {
+ [[ $sr == $'\177' ]] && sr2="${sr2::-1}" || sr2+="$sr"
+ [[ -z $sr2 ]] && get_dir || f=("$PWD"/*"$sr2"*)
+ l=0; refresh; f_print; [[ $sr ]] && prompt /
+ sr2=; return
+ }
esac
refresh; get_dir
}