voidrice/.config/lf/lfrc

74 lines
1.7 KiB
Text
Raw Normal View History

2019-05-24 02:59:30 +00:00
# Luke's lf settings
# Basic vars
set shell sh
2020-04-09 20:56:47 +00:00
set previewer ~/.config/lf/scope
2019-05-24 02:59:30 +00:00
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 & ;;
audio/*) mpv $f ;;
video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;;
2019-05-24 02:59:30 +00:00
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?"
2020-04-08 23:10:00 +00:00
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" &&
2019-05-24 02:59:30 +00:00
eval mv -iv $fx $dest &&
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}}
cmd copyto ${{
set -f
clear; echo "Copy to where?"
2020-04-08 23:10:00 +00:00
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" &&
2019-05-24 02:59:30 +00:00
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
2019-09-23 10:14:33 +00:00
map <c-f> $lf -remote "send $id select '$(fzf)'"
2020-04-08 23:10:00 +00:00
map J $lf -remote "send $id cd $(cut -d' ' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)"
2019-05-24 02:59:30 +00:00
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"