summaryrefslogtreecommitdiffstats
path: root/.config/lf/lfrc
blob: dc96a65d8f573a00cd4a9f7a3dde0915eb9568a8 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Basic vars
set shellopts '-eu'
set ifs "\n"
set scrolloff 10
set shell "/bin/sh"
set icons
set period 1
set dirfirst true
set drawbox true
set preview true
set ratios 1:3:5
set tabstop 4
set previewer '~/.config/lf/scope'

# cmds/functions
cmd open ${{
	case $(file --mime-type "$(readlink -f $f)" -b) in
		application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
		application/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt $f | $PAGER ;;
		image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid zathura $fx >/dev/null 2>&1 ;;
		text/html) $BROWSER $fx ;;
		text/plain) $PAGER $fx ;;
		text/*|application/json|inode/x-empty) bat --style=plain --tabs 4 --paging=always -f $fx ;;
		image/x-xcf) setsid gimp $f >/dev/null 2>&1 ;;
		image/svg+xml) display -- $f ;;
		image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
			nsxiv -aibof 2>/dev/null | while read -r file; do
				[ -z "$file" ] && continue
				lf -remote "send select \"$file\""
				lf -remote "send toggle"
			done &
			;;
		audio/*) setsid $TERMINAL -e mpv --no-audio-display --audio-channels=stereo $fx & ;;
		video/*) setsid mpv --really-quiet --audio-channels=stereo $fx >/dev/null 2>&1 & ;;
		*opendocument*) odt2txt $f | $PAGER ;;
		application/pdf|application/vnd*|application/epub*) setsid zathura $fx >/dev/null 2>&1 ;;
		application/pgp-encrypted) $EDITOR $fx ;;
        *) for f in $fx; do setsid xdg-open $f >/dev/null 2>&1; done;;
    esac
}}

cmd mkdir $mkdir -p "$(echo $* | sed 's/ /\ /g')"
cmd bulkrename $vidir $fx
cmd showallpics $exa *.png *.jpg *.jpeg *.gif *.webp *.tif *.ico 2>/dev/null | nsxiv -taib &
cmd newtermedit $EDITOR $fx

map gr cd /
map gm cd ~/hdd
map gw cd ~/stoc1/work
map gS cd ~/pics/scrot
map gc cd ~/.config
map gb cd ~/.local/bin
map gs cd ~/.local/share
map gp cd ~/.local/packs
map gM cd /mnt
map gt cd /tmp
map gf cd ~/dev/c/c_dergods_realm_2

map za set hidden!
map zh set info size:time
map <c-f> $lf -remote "send $id select '$(fzf)'"
map <enter> open
map D delete
map W $$SHELL
map S $$SHELL
map <c-s> $$SHELL
map <c-n> push :mkdir<space>
map <f-7> push :mkdir<space>
map <c-r> reload
cmap <c-g> cmd-escape
map x !$f
map X $$f
map o $$PAGER $f
map V showallpics
map @ !clear; du -sh .
map ( set ratios 1
map ) set ratios 1:1
map _ set ratios 1:4
map + set ratios 1:3:5
map = set ratios 1:3:5
map P set preview!

map A rename # at the very end
map c push A<c-u> # new rename
map I push A<c-a> # at the very beginning
map i push A<a-b><a-b><a-f> # before extention
map a push A<a-b> # after extention
map B bulkrename
map <f-2> bulkrename

map <c-e> down
map <c-y> up
map e $$EDITOR $fx
map E $st -e $EDITOR $fx &
map <insert> push :$$EDITOR<space>