-
Notifications
You must be signed in to change notification settings - Fork 1
/
lfrc
172 lines (142 loc) · 3 KB
/
lfrc
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
set nopreview
set nohidden
#set drawbox
set icons
set ignorecase
set wrapscroll
set autoquit
#set mouse
#set dircache false
set ratios '1:3'
set info 'size'
set period 1
set timefmt '2006-01-02T15:04:05'
set promptfmt "\033[37m%d%f\033[0m"
set errorfmt "\033[91m%s\033[0m"
set statfmt "\033[37m%p %u:%g\033[0m \033[32m%s\033[0m| → \033[36m%l\033[0m"
#set number
#set numberfmt "\033[37m"
# should be set to \n only so spaces in files are handled correctly
# used mostly when archiving
set ifs "\n"
clearmaps
map . :set hidden!; top
map <delete> delete
map d delete
map c copy
map x cut
# clear after paste to not accidentally delete selection
map v :paste; clear
map a invert
map s :toggle; down
map u :unselect; clear
map <esc> :unselect; clear
map <f-2> rename
map <f-5> reload
map <tab> search
map <f-3> search-next
map <f-1> calcdirsize
map g bottom
map q quit
map <down> down
map <up> up
map <right> open
map <left> updir
map <pgdn> page-down
map <pgup> page-up
map <c-c> quit
map <c-x> quit
map <space> shell
map e ed
# mouse
#map <m-up> up
#map <m-down> down
#map <m-1> updir
#map <m-2> open
# empty open so it navigates but doesnt open anything
cmd open &{{
}}
cmd open2 &{{
if [ -n "${f}" ] && [ ! -d "${f}" ]
then
xdg-open "${f}" > /dev/null 2>&1
fi
}}
map <enter> :open; open2
cmd cp &{{
printf "${f}" | xclip -i -selection clipboard
}}
cmd touch &{{
touch "${f}"
}}
cmd term &{{
termite --directory="${PWD}" > /dev/null 2>&1
}}
map t term
cmd code &{{
code "${PWD}"
}}
cmd thumb &{{
set -f
case "${f}" in
*.bmp|*.png|*.jpg|*.jpeg|*.gif) convert "${f}" -resize 15% "${f%%.*}-thumb.${f#*.}";;
esac
}}
map <backspace2> updir
# bookmarks
map b1 cd ~/_disk/torrents
map b2 cd ~/_private
map b3 cd ~/_public
# archives
# ${f} = current file
# ${fs} = selected file(s)
# ${fx} = selected file(s) or a current file
# set -f = the shell shall disable pathname expansion
# ${{ -> exit UI, run command and return to the UI
# %{{ -> run command with output in the 1-line UI prompt
# !{{ -> same as ${{, but requires a keypress once command exits
# &{{ -> run command completely in the background, invisible to the UI
# do not quote ${fx}, it will have an effect of adding just one file to the parameters
# IFS is \n, otherwise the files processed by spaces in filenames
cmd ed &{{
/usr/bin/qtextpad "${f}"
}}
cmd gz ${{
set -f
for _x in ${fx}
do
set -- "${@}" "$(basename "${_x}")"
done
tar cvzf "${f}.tar.gz" "${@}"
}}
cmd xz ${{
set -f
for _x in ${fx}
do
set -- "${@}" "$(basename "${_x}")"
done
tar cvJf "${f}.tar.xz" "${@}"
}}
cmd ex ${{
set -f
case "${f}" in
*.tar.*|*.tar) tar xvf "${f}";;
*) 7z x "${f}";;
esac
}}
cmd zip ${{
set -f
for _x in ${fx}
do
set -- "${@}" "$(basename "${_x}")"
done
7z a -tzip "${f}.zip" "${@}"
}}
cmd 7z ${{
set -f
for _x in ${fx}
do
set -- "${@}" "$(basename "${_x}")"
done
7z a -t7z "${f}.7z" "${@}"
}}