voidrice/.config/lf/lfrc

75 lines
1.8 KiB
Text
Raw Normal View History

2019-05-24 02:59:30 +00:00
# Luke's lf settings
# Basic vars
set shell sh
set previewer ~/.config/lf/scope
set shellopts '-eu'
set ifs "\n"
set scrolloff 10
2019-09-23 10:14:33 +00:00
set color256
set icons # Enable icons. Requires nerd fonts and LF_ICONS variable.
2019-05-24 02:59:30 +00:00
# cmds/functions
cmd open ${{
case $(file --mime-type $f -b) in
text/troff) man ./ $f;;
text/*) $EDITOR $fx;;
image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;;
2019-12-09 00:20:25 +00:00
image/*) rotdir $f | setsid sxiv -aio 2>/dev/null | lf-select & ;;
2019-05-24 02:59:30 +00:00
audio/*) mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f ;;
video/*) setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f -quiet >/dev/null 2>&1 & ;;
application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;;
*) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;;
esac
}}
cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
cmd delete ${{
set -f
printf "%s\n\t" "$fx"
2019-09-23 10:14:33 +00:00
printf "delete?[y/N]"
2019-05-24 02:59:30 +00:00
read ans
[ $ans = "y" ] && rm -rf $fx
}}
cmd moveto ${{
set -f
clear; echo "Move to where?"
dest="$(cut -d' ' -f2- ~/.config/directories | fzf)" &&
eval mv -iv $fx $dest &&
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}}
cmd copyto ${{
set -f
clear; echo "Copy to where?"
dest="$(cut -d' ' -f2- ~/.config/directories | fzf)" &&
eval cp -ivr $fx $dest &&
notify-send "📋 File(s) copied." "File(s) copies to $dest."
}}
2019-12-09 00:20:49 +00:00
cmd bulkrename ${{
vidir
}}
2019-05-24 02:59:30 +00:00
# Bindings
map c $lf -remote "send $id cd $(cut -d' ' -f2 ~/.config/directories | fzf)"
2019-09-23 10:14:33 +00:00
map <c-f> $lf -remote "send $id select '$(fzf)'"
2019-05-24 02:59:30 +00:00
map J $lf -remote "send $id cd $(cut -d' ' -f2 ~/.config/directories | fzf)"
map gh
map g top
map D delete
map C copyto
map M moveto
map a push %mkdir<space>
map r push :rename<space>
2019-09-23 10:14:33 +00:00
map R $lf -remote "send $id push :rename<space>$f"
2019-12-09 00:20:49 +00:00
map b bulkrename
2019-09-23 10:14:33 +00:00
map <c-r> reload
2019-05-24 02:59:30 +00:00
map <enter> shell
map x $$f
map X !$f
map o &mimeopen "$f"
map O $mimeopen --ask "$f"