about summary refs log tree commit diff stats
path: root/config/lf/lfrc
blob: 21634d48814d465773dbce54a337e5a95caa31cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# sets
set shell sh
set shellopts '-eu'
set ifs "\n"

# cmds
cmd open ${{
    case $(file -bi $f) in
	text/troff) man ./ $f;;
        text/*) $EDITOR $fx;;
	image/x-xcf|image/svg+xml) gimp $f >/dev/null 2>&1 & ;;
	image/vnd.djvu|application/epub+zip|application/pdf) zathura $f >/dev/null 2>&1 & ;;
	image/*) sxiv -ai >/dev/null 2>&1 & ;;
	audio/*) mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) --quiet $f >/dev/null 2>&1 & ;;
	video/*) mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) $f ;;
        *) for f in $fx; do lh $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"
	printf "delete?[y/n]"
	read ans
	[ $ans = "y" ] && rm -rf $fx
}}

# binds
map D delete
map a push %mkdir<space>
map r push :rename<space>
map <enter> shell
map R reload
map x $$f
map X !$f