-
Notifications
You must be signed in to change notification settings - Fork 10
/
rifle.conf
77 lines (49 loc) · 2.4 KB
/
rifle.conf
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
# vim: ft=cfg
# NOTE: Only for macOS usage!
# This file configs ranger's file executor/opener.
# The example of this file can be found here: https://github.com/ranger/ranger/blob/master/ranger/config/rifle.conf
# ==== Code ====
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager = $PAGER -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = $PAGER -- "$@"
# ==== Run code ====
ext py = python3 -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = bash -- "$1"
ext php = php -- "$1"
# ==== Makefile ====
name ^[mM]akefile$ = make
# ==== HTML ====
# Open HTML file in the browser (open_with)
ext x?html?, label browser, X = /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --new-window -- "$@"
# ==== Video/Audio ====
mime ^video|^audio, label iina, X = open -a "IINA" -- "$@"
# ==== Documents ====
ext pdf, label pdfexpert, X = open -a "PDF Expert" -- "$@"
ext docx?, label word, X = open -a "Microsoft Word" -- "$@"
ext xlsx?, label excel, X = open -a "Microsoft Excel" -- "$@"
ext pptx?, label ppt, X = open -a "Microsoft PowerPoint" -- "$@"
# ==== eBooks ====
ext epub, label ebook-viewer, X, has ebook-viewer, flag f = ebook-viewer -- "$@"
ext epub, label ibook, X = open -a "Books" -- "$@"
ext mobi, label ebook-viewer, X, has ebook-viewer, flag f = ebook-viewer -- "$@"
# ==== Images ====
mime ^image/svg, label svg-viewer, X = open -a "Gapplin" -- "$@"
mime ^image, label image-viewer, X = open -a "Pixea" -- "$@"
mime ^image, label preview, X = open -a "Preview" -- "$@"
# ==== Archives ====
# avoid password prompt by providing empty password
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
# atool for listing the contents
ext bz2?|cab|cpio|gz|jar|rar|tar|tgz|xar|xz|zip, label list, has atool = atool --list --each -- "$@" | $PAGER
# atool for extracting
ext 7z|bz2?|cab|cpio|gz|jar|rar|tar|tgz|xar|xz|zip, label extract, has atool = atool --extract --each -- "$@"
# Open with Keka.app (compressing or extracting is determined automatically)
ext 7z|bz2?|cab|cpio|gz|iso|jar|msi|rar|tar|tgz|xpi|xz|zip, label keka, X = open -a "Keka" -- "$@"
# ==== macOS app (.app) ====
ext app, label open, directory, X = open -- "$@"
# ==== Generic file openers ====
label open, X = open -- "$@"