commit c1a50f276acd3813a06b784b0a43965730e02d3a
parent 99d723ff8ec1ba44deff4f7af47e78adcf3e18a8
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Sun, 18 Oct 2020 22:56:42 +0200
lf: trash instead of delete
Yes if you must know, I accidentally deleted some stuff with the big D.
kthxbye.
Former-commit-id: ae030a072a8d14c26cc36487c84a7958027ed068
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lf/lfrc b/lf/lfrc
@@ -130,6 +130,19 @@ cmd z ${{
fi
fi
}}
+
+# trash command with confirmation
+cmd trash %{{
+ for f in $fx; do
+ printf "Trash $f? [Y/n/a] "
+ read -r ans
+ case "$ans" in
+ Y*|y*) trash "$f";;
+ A*|a*) trash $fx; printf "Deleted all files.\n"; break;;
+ *) printf "Not deleting $f\n"; sleep 1;;
+ esac
+ done
+}}
# }}}
# Mappings {{{
# execute current file (must be executable)
@@ -160,7 +173,7 @@ map g? $lf -doc | $PAGER; clear
map R push :rename<space>
map cw push :rename<space>
map E $$EDITOR $f
-map D delete
+map D trash
map <enter> open $fx
map S shell
map Y copy_path
@@ -184,6 +197,7 @@ map gw cd ~/Dropbox/vimwiki
map g/ cd /
map g. cd ~/.dotfiles
map gv cd /Volumes
+map gt cd ~/.Trash/
map u
map uu unselect