]> git.phdru.name Git - dotfiles.git/blob - .mc/menu
.mc/menu: Use selected (`%s`) instead of tagged (`%t`) files
[dotfiles.git] / .mc / menu
1 shell_patterns=0
2
3 # This is necessary to overcome a bug in mc - without this
4 # mc makes default wrong item
5 :  NOOP
6    :
7
8 @  Do something on all of the file(s) at once
9    CMD=%{Enter command}
10    exec $CMD %s
11
12 + t t
13 @  Do something on the selected files one by one
14    CMD=%{Enter command}
15    for f in %s; do
16      $CMD "$f"
17    done
18
19 + t r
20 p  View the file in a pager
21    exec ${PAGER:-more} %f
22
23 + t r
24 g  Edit the file in gvim
25    gvim %f &
26
27 + t r
28 b  View the file in a browser
29    exec webbrowser file://%d/%f
30
31 + t r
32 w  View the file in a new browser window
33    exec webbrowser -n file://%d/%f
34
35 + t r
36 = f \.(htm(l?)|txt)$
37 t  View the file in a new browser tab
38    exec webbrowser -t file://%d/%f
39
40 += f \.fb2(\.bz2|\.gz|\.zip)?$ | f \.(chm|epub|htm(l?)|txt|rtf)$ & t r
41 f  View fb2/chm/epub with fbreader
42    fbreader %f &
43
44 + t r & f \.fb2(\.bz2|\.gz|\.zip)$
45 H  fb2html
46    case %f in
47      *.fb2.bz2) A="bunzip2 -c" ;;
48      *.fb2.gz) A="gunzip -c" ;;
49      *.fb2.zip) A="unzip -p" ;;
50      *.fb2) A="cat" ;;
51    esac
52    $A %f | xsltproc /usr/local/src/FictionBook/FB2_2_html_ru.xsl - | webstdin -t
53
54 + t r & f \.fb2(\.bz2|\.gz|\.zip)$
55 T  fb2txt
56    case %f in
57      *.fb2.bz2) A="bunzip2 -c" ;;
58      *.fb2.gz) A="gunzip -c" ;;
59      *.fb2.zip) A="unzip -p" ;;
60      *.fb2) A="cat" ;;
61    esac
62    $A %f | xsltproc /usr/local/src/FictionBook/FB2_2_txt_ru.xsl - | webstdin -e txt -t
63
64 += t r & f \.(pdf|PDF|ps|PS)(\.bz2|\.gz)?$
65 e  View pdf/ps
66    qpdfview %f &
67
68 += t r & f \.djvu(\.bz2|\.gz)?$
69 e  View djvu
70    djview %f &
71
72 += t r & f \.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
73 o  View OpenDoc with odt2txt
74    odt2txt %f | ${PAGER:-more}
75
76 + t r & f \.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg|doc|DOC|rtf|docx|DOCX|xls|XLS|xlsx|XLSX)$
77 e  Edit (Open)Docs with libreoffice
78    libreoffice %f &
79
80 += t r & f \.(doc|DOC|rtf)$
81 d  View doc with catdoc
82    catdoc %f | ${PAGER:-more}
83
84 += t r & f \.(docx|DOCX)$
85 d  View docx with docx2txt
86    docx2txt %f - | iconv.py -f utf-8 | ${PAGER:-more}
87
88 += t r & f \.(xls|XLS)$
89 x  View xls with xls2csv
90    xls2csv %f | ${PAGER:-more}
91
92 + t r & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$ | t t
93 = t r & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$
94 i  View image(s) scaled
95    xli -title "`echo %s | sed 's/ /_/g'`" -zoom auto %s &
96
97 + t r & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$ | t t
98 I  View image(s) full size
99    xli -title "`echo %s | sed 's/ /_/g'`" %s &
100
101 + t r & f \.(bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|pbm|PBM|ppm|PPM|png|PNG|xbm|xpm)$
102 I  Identify image
103    xli -identify %f
104
105 + t r & f \.(ico|jp2|tif|TIF|tiff|TIFF|webp)$ | t t
106 = t r & f \.(ico|jp2|tif|TIF|tiff|TIFF|webp)$
107 I  View icon, JPEG-2000, TIFF, WebP image
108    display %s &
109
110 + t r & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
111 a  Add the audiofile(s) or playlist(s)
112    #if [ "`audtool --get-volume`" -eq 0 ]; then cgmem_nice 500 audacious & sleep 3; fi
113    #for f in %s; do
114    #   audtool --playlist-addurl "$f"
115    #done
116    #smplayer -add-to-playlist %s &
117    deadbeef --queue %s &
118
119 + t r & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
120 = t r & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$
121 p  Load the audiofile(s) or playlist(s)
122    #if [ "`audtool --get-volume`" -eq 0 ]; then cgmem_nice 500 audacious & sleep 3; fi
123    #audtool --playlist-clear
124    #for f in %s; do
125    #   audtool --playlist-addurl "$f"
126    #done
127    #smplayer -send-action pl_remove_all
128    #smplayer -add-to-playlist %s &
129    deadbeef --queue %s &
130
131 + t r & f \.(aac|ac3|ape|cue|dts|flac|m3u|mka|mp3|MP3|ogg|OGG|pls|WAV|wav|wv)$ | t t
132 P  Play the audiofile(s) or playlist(s)
133    #if [ "`audtool --get-volume`" -eq 0 ]; then cgmem_nice 500 audacious & sleep 3; fi
134    #audtool --playlist-clear
135    #for f in %s; do
136    #   audtool --playlist-addurl "$f"
137    #done
138    #exec audtool --playback-play
139    #mplayer -playlist %f &
140    #smplayer %s &
141    deadbeef %s &
142    #exec mediaplayer_open %f
143
144 + t r & f \.m3u
145 R  Play the playlist in random order
146    "$HOME"/admin/prog/audio-cdr-video/audio/shuffle-playlist.py %f random-playlist-tmp.m3u
147    #if [ "`audtool --get-volume`" -eq 0 ]; then cgmem_nice 500 audacious & sleep 3; fi
148    #audtool --playlist-clear
149    #audtool --playlist-addurl random-playlist-tmp.m3u
150    #audtool --playback-play
151    #mplayer -playlist random-playlist-tmp.m3u &
152    #smplayer random-playlist-tmp.m3u &
153    #smplayer -actions pl_shuffle %f &
154    deadbeef --queue random-playlist-tmp.m3u & deadbeef --play
155    #mediaplayer_open random-playlist-tmp.m3u
156    (sleep 5; exec rm random-playlist-tmp.m3u) &
157
158 + f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
159 s  Play audio/video file(s) or directory with smplayer
160    smplayer %s &
161
162 + t d & f (video_ts|VIDEO_TS)$
163 c  Play the current directory with smplayer
164    smplayer . &
165
166 + t r & f \.(m3u|mp3|MP3|cue|aac|ac3|ape|dts|flac|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$
167 i  Audio/video info
168    exec "$HOME"/.config/mpv/mpv_identify.sh %f
169
170 + t d & f (video_ts|VIDEO_TS)$
171 i  DVD info
172    exec "$HOME"/.config/mpv/mpv_identify.sh .
173
174 + f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t d | t t
175 = f \.(aac|ac3|ape|cue|dts|flac|m3u|mp3|MP3|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|iso|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$
176 m  Play video file(s) with mplayer
177    mplayer %s &
178
179 + f \.(m3u|mp3|MP3|cue|aac|ac3|ape|dts|flac|ogg|OGG|pls|WAV|wav|wv|avi|AVI|flv|m2ts|m4v|mka|mkv|MKV|mov|MOV|mp4|MP4|mpg|MPG|vob|VOB|wma|wmv)$ | t t
180 M  Play audio/video with gmplayer
181    gmplayer %s &
182
183 += t d & f (video_ts|VIDEO_TS)$
184 d  Play DVD directory with mplayer
185    mplayer -dvd-device . dvd:// &
186
187 + t d & f (video_ts|VIDEO_TS)$
188 D  Play DVD directory with gmplayer
189    gmplayer -dvd-device . dvd:// &
190
191 + t d & f (video_ts|VIDEO_TS)$
192 t  Play DVD title with mplayer
193    title=%{Enter title}
194    mplayer -dvd-device . dvd://"$title" &
195
196 + t d & f (video_ts|VIDEO_TS)$
197 T  Play DVD title with gmplayer
198    title=%{Enter title}
199    gmplayer -dvd-device . dvd://"$title" &
200
201 + t d
202 p  Play directory with mplayer
203    mplayer %f/* &
204
205 + t d
206 P  Play directory with gmplayer
207    gmplayer %f/* &
208
209 + t d & f ^\.\.$
210 b  Compress the current subdirectory to tar.bz2
211    Pwd="`basename %d /`"
212    echo -n "Name of the distribution file (without extension) [$Pwd]: "
213    read tar
214    if [ "$tar"x = x ]; then tar="$Pwd"; fi
215    cd .. && tar cvf - "$Pwd" | bzip2 -f9 > "$tar".tar.bz2 &&
216    echo ../"$tar".tar.bz2 created.
217
218 + t d & f ^\.\.$
219 g  Compress the current subdirectory to tar.gz
220    Pwd="`basename %d /`"
221    echo -n "Name of the distribution file (without extension) [$Pwd]: "
222    read tar
223    if [ "$tar"x = x ]; then tar="$Pwd"; fi
224    cd .. && tar cvf - "$Pwd" | gzip -f9 > "$tar".tar.gz &&
225    echo ../"$tar".tar.gz created.
226
227 + t d & f ^\.\.$
228 l  Compress the current subdirectory to tar.lzma
229    Pwd="`basename %d /`"
230    echo -n "Name of the distribution file (without extension) [$Pwd]: "
231    read tar
232    if [ "$tar"x = x ]; then tar="$Pwd"; fi
233    cd .. && tar cvf - "$Pwd" | lzma -f9 > "$tar".tar.lzma &&
234    echo ../"$tar".tar.lzma created.
235
236 + t d & f ^\.\.$
237 x  Compress the current subdirectory to tar.xz
238    Pwd="`basename %d /`"
239    echo -n "Name of the distribution file (without extension) [$Pwd]: "
240    read tar
241    if [ "$tar"x = x ]; then tar="$Pwd"; fi
242    cd .. && tar cvf - "$Pwd" | xz -f9 > "$tar".tar.xz &&
243    echo ../"$tar".tar.xz created.
244
245 + t d & f ^\.\.$
246 t  Compress the current subdirectory to tar
247    Pwd="`basename %d /`"
248    echo -n "Name of the distribution file (without extension) [$Pwd]: "
249    read tar
250    if [ "$tar"x = x ]; then tar="$Pwd"; fi
251    cd .. && tar cvf - "$Pwd" > "$tar".tar &&
252    echo ../"$tar".tar created.
253
254 + t d & f ^\.\.$
255 z  Compress the current subdirectory to zip
256    Pwd="`basename %d /`"
257    echo -n "Name of the distribution file (without extension) [$Pwd]: "
258    read zip
259    if [ "$zip"x = x ]; then zip="$Pwd"; fi
260    cd .. && zip -r9 "$zip".zip "$Pwd" &&
261    echo ../"$zip".zip created.
262
263 + t d & f ^\.\.$
264 y  Compress the current subdirectory to zip with recoded filenames
265    Pwd="`basename %d /`"
266    echo -n "Name of the distribution file (without extension) [$Pwd]: "
267    read zip
268    if [ "$zip"x = x ]; then zip="$Pwd"; fi
269    cd .. && zip.py "$zip".zip "$Pwd" &&
270    echo ../"$zip".zip created.
271
272 + t d & f ^\.\.$
273 7  Compress the current subdirectory to 7z
274    Pwd="`basename %d /`"
275    echo -n "Name of the distribution file (without extension) [$Pwd]: "
276    read ar
277    if [ "$ar"x = x ]; then ar="$Pwd"; fi
278    cd .. && 7zr a "$ar".7z "$Pwd" &&
279    echo ../"$ar".7z created.
280
281 + ! f \.(bz2|gz|lz|lzma|7z|xz|zip|ZIP)$ & t r
282 z  bzip2 the file
283    exec bzip2 -9 %f
284
285 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
286 z  gzip the file
287    exec gzip -9 %f
288
289 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
290 z  lzip the file
291    exec lzip -9 %f
292
293 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
294 z  lzma the file
295    exec lzma -9 %f
296
297 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
298 z  7z the file/directory
299    exec 7zr a %f.7z %f
300
301 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
302 z  xz the file
303    exec xz -9 %f
304
305 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
306 z  zip the file/directory
307    exec zip -r9 %f.zip %f
308
309 + ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
310 y  zip the file/directory with recoded filename(s)
311    exec zip.py %f.zip %f
312
313 + t t
314 Z  zip selected files/directories
315    ZIP=%{Enter zip name}
316    exec zip -r9 "$ZIP" %s
317
318 + t t
319 Y  zip these files/directories with recoded filenames
320    ZIP=%{Enter zip name}
321    exec zip.py "$ZIP" %s
322
323 + f \.(tar\.(z|Z|bz2|gz|lz|lzma))|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t r
324 n  Create a directory for this archive
325    case %f in
326      *.tar.Z)    D="`basename %f .tar.Z`";;
327      *.tar.bz2)  D="`basename %f .tar.bz2`";;
328      *.tar.gz)   D="`basename %f .tar.gz`";;
329      *.tbz2)     D="`basename %f .tbz2`";;
330      *.tgz)      D="`basename %f .tgz`";;
331      *.tz)       D="`basename %f .tz`";;
332      *.tar.lz)   D="`basename %f .tar.lz`";;
333      *.tar.lzma) D="`basename %f .tar.lzma`";;
334      *.tar.7z)   D="`basename %f .tar.7z`";;
335      *.zip)      D="`basename %f .zip`";;
336      *.ZIP)      D="`basename %f .ZIP`";;
337      *.rar)      D="`basename %f .rar`";;
338      *.RAR)      D="`basename %f .RAR`";;
339      *.xz)       D="`basename %f .xz`";;
340      *.7z)       D="`basename %f .7z`";;
341    esac
342    exec mkdir "$D"
343
344 + F \.(tar\.(z|Z|bz2|gz|lz|lzma))|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & T r
345 N  Create a directory for the other archive
346    case %D/%F in
347      *.tar.Z)    D="`basename %F .tar.Z`";;
348      *.tar.bz2)  D="`basename %F .tar.bz2`";;
349      *.tar.gz)   D="`basename %F .tar.gz`";;
350      *.tbz2)     D="`basename %F .tbz2`";;
351      *.tgz)      D="`basename %F .tgz`";;
352      *.tz)       D="`basename %F .tz`";;
353      *.tar.lz)   D="`basename %F .tar.lz`";;
354      *.tar.lzma) D="`basename %F .tar.lzma`";;
355      *.tar.7z)   D="`basename %F .tar.7z`";;
356      *.zip)      D="`basename %F .zip`";;
357      *.ZIP)      D="`basename %F .ZIP`";;
358      *.rar)      D="`basename %F .rar`";;
359      *.RAR)      D="`basename %F .RAR`";;
360      *.xz)       D="`basename %F .xz`";;
361      *.7z)       D="`basename %F .7z`";;
362    esac
363    exec mkdir "$D"
364
365 + f \.(tar\.(z|Z|bz2|gz|lz|lzma|7z|xz))|(tbz2|tgz|tz)$ & t r
366 x  Extract the contents of a compressed tar file
367    unset PRG
368    case %f in
369       *.tar.bz2|*.tbz2)
370          PRG="bunzip2 -c"
371       ;;
372       *.tar.gz|*.tar.z|*.tgz|*.tz|*.tar.Z)
373          PRG="gzip -dc"
374       ;;
375       *.tar.lz)
376          PRG="lzip -dc"
377       ;;
378       *.tar.lzma)
379          PRG="lzma -dc"
380       ;;
381       *.tar.7z)
382          PRG="7zr e -so"
383       ;;
384       *.tar.xz)
385          PRG="xz -dc"
386       ;;
387       *)
388       exit 1
389       ;;
390    esac
391    $PRG %f | tar xvpf -
392
393 + F \.(tar\.(z|Z|bz2|gz|lz|lzma|7z|xz))|(tbz2|tgz|tz)$ & T r
394 X  Extract the contents of an other compressed tar file
395    unset PRG
396    case %F in
397       *.tar.bz2|*.tbz2)
398          PRG="bunzip2 -c"
399       ;;
400       *.tar.gz|*.tar.z|*.tgz|*.tz|*.tar.Z)
401          PRG="gzip -dc"
402       ;;
403       *.tar.lz)
404          PRG="lzip -dc"
405       ;;
406       *.tar.lzma)
407          PRG="lzma -dc"
408       ;;
409       *.tar.7z)
410          PRG="7zr e -so"
411       ;;
412       *.tar.xz)
413          PRG="xz -dc"
414       ;;
415       *)
416       exit 1
417       ;;
418    esac
419    $PRG %D/%F | tar xvpf -
420
421 + f \.(bz2|egg|gz|lz|lzma|7z|xz|tar|whl|zip|ZIP|rar|RAR)$ & t r
422 x  Extract a compressed file
423    case %f in
424      *.bz2)  P="bzip2 -d";;
425      *.gz)   P="gzip -d";;
426      *.lz)   P="lzip -d";;
427      *.lzma) P="lzma -d";;
428      *.7z)   P="7zr x";;
429      *.xz)   P="xz -d";;
430      *.tar)  P="tar xvpf";;
431      *.egg|*.whl|*.zip|*.ZIP) P="unzip";;
432      *.rar|*.RAR) P="unrar x -y";;
433    esac
434    exec $P %f
435
436 + F \.(bz2|egg|gz|lz|lzma|7z|xz|tar|whl|zip|ZIP|rar|RAR)$ & T r
437 X  Extract another compressed file
438    case %F in
439      *.bz2)  P="bzip2 -d";;
440      *.gz)   P="gzip -d";;
441      *.lz)   P="lzip -d";;
442      *.lzma) P="lzma -d";;
443      *.7z)   P="7zr x";;
444      *.xz)   P="xz -d";;
445      *.tar)  P="tar xvpf";;
446      *.egg|*.whl|*.zip|*.ZIP) P="unzip";;
447      *.rar|*.RAR) P="unrar x -y";;
448    esac
449    exec $P %D/%F
450
451 + t r & f \.(zip|ZIP)$
452 y  Extract from zip with recoded filenames
453    exec unzip.py %f
454
455 + T r & F \.(zip|ZIP)$
456 Y  Extract from other zip with recoded filenames
457    exec unzip.py %D/%F
458
459 + t r
460 v  View via mailcap
461    exec see %f
462
463 + t r
464 c  Compare the file
465    exec cmp %D/%f %f
466
467 + t r & T r
468 C  Compare these files
469    exec cmp %D/%F %f
470
471 + t r
472 d  Diff the file
473    exec diff -u --speed-large-files %D/%f %f
474
475 + t r & T r
476 D  Diff these files
477    exec diff -u --speed-large-files %D/%F %f
478
479 + t r
480 v  vimdiff the file
481    exec vim -d %D/%f %f
482
483 + t r & T r
484 V  vimdiff these files
485    exec vim -d %D/%F %f
486
487 + t d & ! f ^\.\.$
488 d  Diff the directory
489    exec diff -ru --speed-large-files \
490       -x CVS -x .git -x .hg -x .svn -x '*.py[co]' -x __pycache__ %D/%f %f
491
492 + t d & T d & ! F ^\.\.$
493 D  Diff these directories
494    exec diff -ru --speed-large-files \
495       -x CVS -x .git -x .hg -x .svn -x '*.py[co]' -x __pycache__ %D/%F %f
496
497 += f \.(asc|sig(n)?)$ & t r
498 v  Verify signature
499    exec gpg --verify %f
500
501 += f \.[1-8]$ | f \.man$ & t r
502 1  Display the file with roff -man
503    %view nroff -man %f
504
505 m  View a manual page
506    MAN=%{Enter manual name}
507    %view man -P cat $MAN
508
509 + t r | t d | t t
510 r  rsync the file(s) there
511    rsync -ahPv --del %s %D