blob: 952762a0a90e5f08cd6132186ed871d675a36347 (
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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
set hidden true
# set color256 true
set drawbox true
set icons true
set ignorecase true
set relativenumber true
set ratios 2:3
set preview false
set previewer ~/.config/lf/previewer.sh
# Function definitions {{{
cmd open_inplace ${{
case $(file --mime-type "$f" -bL) in
text/*|application/json) $EDITOR "$fx" 2&> /dev/null ;;
video/*) setsid -f swallow mpv "$f" 2&> /dev/null ;;
image/gif) setsid -f swallow mpv "$f" 2&> /dev/null ;;
image/*) setsid -f swallow sxiv "$f" 2&> /dev/null ;;
application/pdf) setsid -f swallow zathura "$f" 2&> /dev/null ;;
*)
for f in "$fx"; do
~/scripts/bin/open "$f"
done
;;
esac;
disown;
}}
cmd open ${{
case $(file --mime-type "$f" -bL) in
text/*|application/json) $EDITOR "$fx" ;;
video/*|application/pdf) ~/scripts/bin/open "$f" & ;;
*)
for f in "$fx"; do
~/scripts/bin/open "$f"
done
;;
esac;
disown;
}}
cmd mkdir ${{
printf "Directory Name: "
read ans
mkdir $ans
}}
cmd mkfile ${{
printf "File Name: "
read ans
$EDITOR $ans
}}
cmd move_to_trash ${{
mkdir -p /tmp/.trash-cache/
echo "$fx" | while read file; do
mv "$file" /tmp/.trash-cache/
done;
}}
cmd rename %{{
printf " Rename to: "
read ans
mv "$f" "$ans"
}}
cmd set_wallpaper $feh --bg-scale "$f"
cmd show_images ${{
if [ "$(echo "$fx" | wc -l)" = "1" ]; then
swallow sxiv $(dirname "$fx") &
else
swallow sxiv $fx &
fi;
}}
# }}}
# Unset old keys {{{
map w
map m
map n
map "'"
map '"'
map d}}
map c
map e
map d
# }}}
# Mutations
map dd move_to_trash
map p paste
map x cut
map y copy
map mf mkfile
map md mkdir
map wp set_wallpaper
map rr rename
# View changes
map <enter> open_inplace
map si show_images
map du $du -h -d1 | less
map sh :set hidden!
map st :set sortby time
# Traversal keys
map gde cd ~/Desktop
map gdl cd ~/Downloads/dl
map gdm cd ~/Downloads/music
map gdv cd ~/dev
map gs cd ~/scripts
map gp cd ~/Pictures
|