diff options
author | Dylan Araps <dylan.araps@gmail.com> | 2019-01-04 18:24:51 +0200 |
---|---|---|
committer | Dylan Araps <dylan.araps@gmail.com> | 2019-01-04 18:24:51 +0200 |
commit | b43485162898f0f1a9dd9749fb5bbdb3b4180d4f (patch) | |
tree | d52eea94faf0dfbba6f74c86758577d92a8ab681 | |
parent | e8c08584a43eb4463cedb8cf690567ce12702082 (diff) |
customiable trash. Closes #33
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | fff | 6 | ||||
-rw-r--r-- | fff.1 | 3 |
3 files changed, 9 insertions, 3 deletions
@@ -87,6 +87,9 @@ export FFF_EDITOR="vim" # alternative: export EDITOR="vim" # File Opener export FFF_OPENER="xdg-open" +# Trash Directory +export FFF_TRASH="xdg-open" + # Favourites (keys 1-9) (dir or file) export FFF_FAV1=~/projects export FFF_FAV2=~/.bashrc @@ -68,7 +68,7 @@ prompt() { r) read -rp "rename ${f[l]##*/}: "; [[ $REPLY ]] && \ mv "${f[l]}" "$PWD/$REPLY" ;; d) read -n 1 -rp "trash ${f[l]##*/}? [y/n]: " y; [[ $y == y ]] && { - mv "${f[l]}" ~/.cache/fff/trash/; ((l>0?l--:l)); } ;; + 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"*) @@ -95,7 +95,7 @@ key() { r|d|n|f|/) prompt "$1" ;; \~) g="$PWD"; hist; open ~ ;; - t) g="$PWD"; hist; open ~/.cache/fff/trash ;; + t) g="$PWD"; hist; open "$FFF_TRASH" ;; [1-9]) fa="FFF_FAV${1}"; fa="${!fa}" [[ $fa ]] && { g="$PWD"; hist; open "${fa%/}"; } ;; @@ -110,7 +110,7 @@ key() { main() { shopt -s nocaseglob nullglob checkwinsize - mkdir -p ~/.cache/fff/trash/ + mkdir -p "${FFF_TRASH:=~/.cache/fff/trash/}" pushd "$1" &>/dev/null ||:; refresh; get_dir; f_print trap "refresh; printf '\\e[m\\e[?25h\\e[?7h'" EXIT @@ -110,6 +110,9 @@ export FFF_EDITOR="vim" # alternative: export EDITOR="vim" \fBFile Opener\fR export FFF_OPENER="xdg-open" .TP +\fBTrash Directory\fR +export FFF_TRASH=~/.cache/fff/trash +.TP \fBFavourites (keys 1-9) (dir or file)\fR export FFF_FAV1=~/projects |