about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorZoran Plesivcak <zplesiv@gmail.com>2020-11-08 10:40:13 +0000
committerZoran Plesivcak <zplesiv@gmail.com>2020-11-08 10:40:13 +0000
commita8105b082f94729669d0509f07c98aa566c0278f (patch)
tree201df20c59811a75a683b4b2dd09830484818e67 /ranger
parente4d2f6ec877432382c4cf5b6ad58461aac3ae7af (diff)
downloadranger-a8105b082f94729669d0509f07c98aa566c0278f.tar.gz
Allow $PAGER to contain spaces (handle pager flags)
This change is similar to: c826091a74e88102ca1795ab9798dd8b8498f653 .
See the referenced commit for the explanation.

Note that $PAGER is not a strictly better than "$PAGER". In the
cases where the pager executable in PAGER contains spaces e.g.
"/path with spaces/bin/less" the "$PAGER" works correctly and $PAGER
doesn't. This occurrence is much less frequent than pager in PAGER
containing flags, e.g. "less -R" which works correctly with $PAGER, but
doesn't with "$PAGER".

This change is a desirable trade-off.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/rifle.conf16
1 files changed, 8 insertions, 8 deletions
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf
index f4d8f012..c9834224 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -86,9 +86,9 @@ ext x?html?, has w3m,               terminal = w3m "$@"
 #-------------------------------------------
 # Define the "editor" for text files as first action
 mime ^text,  label editor = ${VISUAL:-$EDITOR} -- "$@"
-mime ^text,  label pager  = "$PAGER" -- "$@"
+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" -- "$@"
+!mime ^text, label pager,  ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php = $PAGER -- "$@"
 
 ext 1                         = man "$1"
 ext s[wmf]c, has zsnes, X     = zsnes "$1"
@@ -156,7 +156,7 @@ ext pdf, has qpdfview, X, flag f = qpdfview "$@"
 ext pdf, has open,     X, flag f = open "$@"
 
 ext sc,    has sc,                    = sc -- "$@"
-ext docx?, has catdoc,       terminal = catdoc -- "$@" | "$PAGER"
+ext docx?, has catdoc,       terminal = catdoc -- "$@" | $PAGER
 
 ext                        sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric,    X, flag f = gnumeric -- "$@"
 ext                        sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread,     X, flag f = kspread -- "$@"
@@ -207,15 +207,15 @@ ext xcf,                    X, flag f = gimp -- "$@"
 #-------------------------------------------
 
 # avoid password prompt by providing empty password
-ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
+ext 7z, has 7z = 7z -p l "$@" | $PAGER
 # This requires atool
-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 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 -- "$@"
 
 # Listing and extracting archives without atool:
-ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
+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
@@ -275,7 +275,7 @@ label open, has open     = open -- "$@"
 # Define the editor for non-text files + pager as last action
               !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php  = ask
 label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php  = ${VISUAL:-$EDITOR} -- "$@"
-label pager,  !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php  = "$PAGER" -- "$@"
+label pager,  !mime ^text, !ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php  = $PAGER -- "$@"
 
 
 ######################################################################