diff options
Diffstat (limited to 'ranger/defaults/rifle.conf')
-rw-r--r-- | ranger/defaults/rifle.conf | 71 |
1 files changed, 50 insertions, 21 deletions
diff --git a/ranger/defaults/rifle.conf b/ranger/defaults/rifle.conf index 5af05a99..ea5af67a 100644 --- a/ranger/defaults/rifle.conf +++ b/ranger/defaults/rifle.conf @@ -1,39 +1,65 @@ +# vim: ft=cfg +# +# This is the configuration file of "rifle", ranger's file executor/opener. +# Each line consists of conditions and a command. For each line the conditions +# are checked and if they are met, the respective command is run. +# +# Syntax: +# <condition1> , <condition2> , ... = command +# +# The command can contain these environment variables: +# $1-$9 | The n-th selected file +# $@ | All selected files +# +# These conditions are currently supported: +# ext <regexp> | The regexp matches the extension of $1 +# mime <regexp> | The regexp matches the mime type of $1 +# name <regexp> | The regexp matches the basename of $1 +# path <regexp> | The regexp matches the absolute path of $1 +# has <program> | The program is installed (i.e. located in $PATH) +# terminal | stdin, stderr and stdout are connected to a terminal +# X | $DISPLAY is not empty (i.e. Xorg runs) +# +# There are also pseudo-conditions which have a "side effect": +# flag <flags> | Change how the program is run. See below. +# label <label> | Assign a label or name to the rule. +# else | Always true. +# +# These flags are currently supported for the "flag" condition: +# f | fork the program to the background +# p | pipe the output into "$PAGER" or "less" +# w | ask the user to press enter after the process has been executed + #------------------------------------------- # Misc #------------------------------------------- -name [xX]modmap = xmodmap "$1" -ext 1 = man "$1" +mime ^text = "$EDITOR" -- "$@" +ext xml|csv|tex = "$EDITOR" -- "$@" +ext 1 = man "$1" ext s[wmf]c, has zsnes, X = zsnes "$1" ext nes, has fceux, X = fceux "$1" -ext exe = wine "$1" -name ^[mM]akefile$ = make - -mime ^text = "$EDITOR" -- "$@" -ext xml|csv|tex = "$EDITOR" -- "$@" +ext exe = wine "$1" +name ^[mM]akefile$ = make #-------------------------------------------- # Code #------------------------------------------- - -label execute, ext py = python -- "$1" -label execute, ext pl = perl -- "$1" -label execute, ext rb = ruby -- "$1" -label execute, ext sh = bash -- "$1" -label execute, ext c = gcc -o /tmp/a.out "$1" && /tmp/a.out -label execute, ext tex = pdflatex -- "$1" && "$rifle" "$(echo -n "$1" | sed 's/\..*$//')".pdf - -label compile, ext c = gcc -o /tmp/a.out "$1" +ext py = python -- "$1" +ext pl = perl -- "$1" +ext rb = ruby -- "$1" +ext sh = bash -- "$1" +ext php = php -- "$1" #-------------------------------------------- # Audio without X #------------------------------------------- mime ^audio, terminal, has mplayer = mplayer -- "$@" mime ^audio, terminal, has mplayer2 = mplayer2 -- "$@" +ext midi?, terminal, has wildmidi = wildmidi -- "$@" #-------------------------------------------- # Video/Audio with a GUI #------------------------------------------- - mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" mime ^video|audio, has smplayer, X, flag f = smplayer -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" @@ -50,8 +76,6 @@ mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" mime ^video, terminal, has mplayer2 = mplayer2 -- "$@" mime ^video, terminal, has mplayer = mplayer -- "$@" -ext midi?, terminal, has wildmidi = wildmidi -- "$@" - #------------------------------------------- # Image Viewing: #------------------------------------------- @@ -84,8 +108,13 @@ ext djvu, has evince, X, flag f = evince -- "$@" #------------------------------------------- # Archives #------------------------------------------- -ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz|iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack, flag p = als -- "$@" -ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz|iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@" +# This requires atool +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als, flag p = als -- "$@" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als, flag p = als -- "$@" +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack, flag p = aunpack -- "$@" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack, flag p = aunpack -- "$@" + +# Fallback: ext tar|gz, has tar = tar vvtf "$@" ext tar|gz, has tar = tar vvxf "$@" |