From f84e9174c9acbbc53e7a6492af98d7cccaa35ba8 Mon Sep 17 00:00:00 2001 From: lanxu Date: Sun, 9 Jun 2019 17:09:18 +0300 Subject: [PATCH] Updated Ranger configuration --- .config/ranger/rc.conf | 5 +++++ .config/ranger/rifle.conf | 41 +++++++++++++++++++++++++++++++++++++-- .config/ranger/scope.sh | 17 +++++++++------- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index fafef35..e9ef425 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -371,8 +371,10 @@ map chain console; eval fm.ui.console.history_move(-1) map Mf linemode filename map Mi linemode fileinfo map Mm linemode mtime +map Mh linemode humanreadablemtime map Mp linemode permissions map Ms linemode sizemtime +map MH linemode sizehumanreadablemtime map Mt linemode metatitle # Tagging / Marking @@ -476,6 +478,9 @@ map pl paste_symlink relative=False map pL paste_symlink relative=True map phl paste_hardlink map pht paste_hardlinked_subtree +map pd console paste dest= +map p` paste dest=%any_path +map p' paste dest=%any_path map dD console delete diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index 5bc59f5..64bdea0 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -152,7 +152,7 @@ ext pdf, has atril, X, flag f = atril -- "$@" ext pdf, has okular, X, flag f = okular -- "$@" ext pdf, has epdfview, X, flag f = epdfview -- "$@" ext pdf, has qpdfview, X, flag f = qpdfview "$@" -ext pdf, has open, X, flat f = open "$@" +ext pdf, has open, X, flag f = open "$@" ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" @@ -165,16 +165,18 @@ ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, f ext djvu, has zathura,X, flag f = zathura -- "$@" ext djvu, has evince, X, flag f = evince -- "$@" ext djvu, has atril, X, flag f = atril -- "$@" +ext djvu, has djview, X, flag f = djview -- "$@" ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@" ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@" #------------------------------------------- -# Image Viewing: +# Images #------------------------------------------- mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" mime ^image/svg, has display, X, flag f = display -- "$@" +mime ^image, has imv, X, flag f = imv -- "$@" mime ^image, has pqiv, X, flag f = pqiv -- "$@" mime ^image, has sxiv, X, flag f = sxiv -- "$@" mime ^image, has feh, X, flag f = feh -- "$@" @@ -183,6 +185,8 @@ mime ^image, has ristretto, X, flag f = ristretto "$@" mime ^image, has eog, X, flag f = eog -- "$@" mime ^image, has eom, X, flag f = eom -- "$@" mime ^image, has nomacs, X, flag f = nomacs -- "$@" +mime ^image, has geeqie, X, flag f = geeqie -- "$@" +mime ^image, has gwenview, X, flag f = gwenview -- "$@" mime ^image, has gimp, X, flag f = gimp -- "$@" ext xcf, X, flag f = gimp -- "$@" @@ -209,6 +213,39 @@ ext ace, has unace = for file in "$@"; do unace e "$file"; done ext rar, has unrar = unrar l "$1" | less ext rar, has unrar = for file in "$@"; do unrar x "$file"; done +#------------------------------------------- +# Fonts +#------------------------------------------- +mime ^font, has fontforge, X, flag f = fontforge "$@" + +#------------------------------------------- +# Flag t fallback terminals +#------------------------------------------- +# Rarely installed terminal emulators get higher priority; It is assumed that +# if you install a rare terminal emulator, you probably use it. +# gnome-terminal/konsole/xterm on the other hand are often installed as part of +# a desktop environment or as fallback terminal emulators. +mime ^ranger/x-terminal-emulator, has terminology = terminology -e "$@" +mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@" +mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@" +mime ^ranger/x-terminal-emulator, has sakura = sakura -e "$@" +mime ^ranger/x-terminal-emulator, has lilyterm = lilyterm -e "$@" +#mime ^ranger/x-terminal-emulator, has cool-retro-term = cool-retro-term -e "$@" +mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"' +#mime ^ranger/x-terminal-emulator, has yakuake = yakuake -e "$@" +mime ^ranger/x-terminal-emulator, has guake = guake -ne "$@" +mime ^ranger/x-terminal-emulator, has tilda = tilda -c "$@" +mime ^ranger/x-terminal-emulator, has st = st -e "$@" +mime ^ranger/x-terminal-emulator, has terminator = terminator -x "$@" +mime ^ranger/x-terminal-emulator, has urxvt = urxvt -e "$@" +mime ^ranger/x-terminal-emulator, has pantheon-terminal = pantheon-terminal -e "$@" +mime ^ranger/x-terminal-emulator, has lxterminal = lxterminal -e "$@" +mime ^ranger/x-terminal-emulator, has mate-terminal = mate-terminal -x "$@" +mime ^ranger/x-terminal-emulator, has xfce4-terminal = xfce4-terminal -x "$@" +mime ^ranger/x-terminal-emulator, has konsole = konsole -e "$@" +mime ^ranger/x-terminal-emulator, has gnome-terminal = gnome-terminal -- "$@" +mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@" + #------------------------------------------- # Misc #------------------------------------------- diff --git a/.config/ranger/scope.sh b/.config/ranger/scope.sh index 95718ed..7c7b99e 100755 --- a/.config/ranger/scope.sh +++ b/.config/ranger/scope.sh @@ -35,9 +35,10 @@ FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lowe # Settings HIGHLIGHT_SIZE_MAX=262143 # 256KiB -HIGHLIGHT_TABWIDTH=8 -HIGHLIGHT_STYLE='pablo' -PYGMENTIZE_STYLE='autumn' +HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8} +HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo} +HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}" +PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn} handle_extension() { @@ -108,7 +109,7 @@ handle_image() { case "${mimetype}" in # SVG - image/svg+xml) + image/svg+xml|image/svg) convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6 exit 1;; @@ -235,9 +236,11 @@ handle_mime() { local pygmentize_format='terminal' local highlight_format='ansi' fi - highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \ - --style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5 - # pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5 + env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \ + --out-format="${highlight_format}" \ + --force -- "${FILE_PATH}" && exit 5 + pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\ + -- "${FILE_PATH}" && exit 5 exit 2;; # DjVu