# vim: ft=cfg #== Websites ext x?html?, has google-chrome, X, flag f = google-chrome "$@" ext x?html?, has firefox, X, flag f = firefox -- "$@" ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@" #== Misc mime ^text, label editor = ${EDITOR} -- "$@" mime ^text, label pager = "$PAGER" -- "$@" !mime ^text, label editor, ext json|csv|tex|py|rb|js|sh = ${EDITOR} -- "$@" !mime ^text, label pager, ext json|csv|tex|py|rb|js|sh = "$PAGER" -- "$@" name ^[mM]akefile$ = make #== Scripts ext py = python -- "$1" ext rb = ruby -- "$1" ext js = node -- "$1" ext sh = sh -- "$1" #== Video/Audio mime ^video, has mpv, X, flag f = mpv -- "$@" mime ^video, has mpv, X, flag f = mpv --fs -- "$@" mime ^video|audio, has vlc, X, flag f = vlc -- "$@" #== Documents ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" ext pdf, has zathura, X, flag f = zathura -- "$@" ext djvu, has zathura, X, flag f = zathura -- "$@" ext epub, has zathura, X, flag f = zathura -- "$@" #== Images mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" mime ^image, has feh, X, flag f = feh -- "$@" mime ^image, has ristretto, X, flag f = ristretto "$@" mime ^image, has gimp, X, flag f = gimp -- "$@" ext xcf, X, flag f = gimp -- "$@" #== Archives ext 7z, has 7z = 7z -p l "$@" | "$PAGER" ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER" ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER" ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@" ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@" ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER" ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done ext zip, has unzip = unzip -l "$1" | less ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done ext rar, has unrar = unrar l "$1" | less ext rar, has unrar = for file in "$@"; do unrar x "$file"; done #== Terminals mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@" mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@"