1
0
Fork 0
ryzowanie/config/lf/lfrc

91 lines
1.7 KiB
Text
Raw Normal View History

2024-06-11 21:55:28 +02:00
set drawbox true
set icons true
set period 1
set previewer ~/.config/lf/preview
set cleaner ~/.config/lf/cleaner
set info size
cmd open_new_lf_here ${{
setsid -f st lfrun $(pwd)
}}
cmd open ${{
case $(file --mime-type -b "$(readlink -f "$f")") in
application/pdf) setsid -f okular "$fx" >/dev/null 2>&1 ;;
image/vnd.djvu) setsid -f okular "$fx" >/dev/null 2>&1 ;;
image/*) setsid -f nsxiv -a "$fx" . ;;
audio/*) setsid -f mpv "$f" >/dev/null 2>&1 ;;
video/*) setsid -f mpv -quiet "$f" >/dev/null 2>&1 ;;
*) for f in "$fx"; do setsid -f $OPENER "$f" >/dev/null 2>&1; done ;;
esac
}}
cmd trash ${{
while IFS= read -r file
do
trash-put "$file"
done <<<"$fx"
}}
cmd delete ${{
clear; tput cup $(($(tput lines)/3)); tput bold
printf "%s\n" "$fx"
printf "\n\t"
printf "delete all/partial/none? [a/p/n]"
read ans
# all
if [ $ans = "a" ]
then
while IFS= read -r file
do
printf "deleting $file"
rm -rf "$file"
done <<<"$fx"
fi
# partial
if [ $ans = "p" ]
then
while IFS= read -r file
do
printf "delete $file? [y/n]"
read -u 1 ans
[ $ans = "y" ] && rm -rf "$file"
done <<<"$fx"
fi
}}
cmd bulkrename ${{
/bin/sh -c "vimv $(echo -e "$fx" | xargs -i echo "\\'{}\\'" | xargs echo)"
}}
cmd real_symlink ${{
ln -sr "$fs" "$(basename "$fs")"
}}
cmd copy_path ${{
echo "$f" | xclip -sel clip
}}
cmd copy_filename ${{
basename "$f" | xclip -sel clip
}}
map Dd trash
map Dp delete
map A rename # at the very end
map I push A<c-a> # at the very beginning
map o open
map .r real_symlink
map .p copy_path
map .f copy_filename