[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ranger-users] enhance preview script
From: |
Liu Yubao |
Subject: |
[Ranger-users] enhance preview script |
Date: |
Sun, 30 Jan 2011 10:34:39 +0800 |
[[ please Cc to me, I don't subscribe this list.]]
Hi,
I enhanced the script with the patch against master branch to add
these features:
(1) add -l 10 to pdftotext to speed up the response, or ranger will
freeze on my box
(2) add -nopgbrk to suppress ^L in output of pdftotext
(3) support w3m text web browser, this is installed in all Debian
boxes by default
(4) split long lines in output of preview mode for pdf/html as I don't
like to press 'l' to scroll,
thus also make scope.sh return 0 in these cases to adapt width
change of the preview column.
I don't split for output of highlight because I think they are
often well formatted and don't
have too much long lines.
Hope they are useful.
Regards,
Yubao Liu
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 754b54d..db184f9 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -41,12 +41,13 @@ case "$extension" in
exit 1;;
# PDF documents:
pdf)
- pdftotext -q "$path" - | head -n $maxln
- success && exit 3 || exit 1;;
+ pdftotext -l 10 -nopgbrk -q "$path" - | head -n $maxln
| fmt -s -w $width
+ success && exit 0 || exit 1;;
# HTML Pages:
htm|html|xhtml)
- have lynx && lynx -dump "$path" | head -n $maxln && exit 5
- have elinks && elinks -dump "$path" | head -n $maxln && exit 5
+ have w3m && w3m -dump "$path" | head -n $maxln |
fmt -s -w $width && exit 0
+ have lynx && lynx -dump "$path" | head -n $maxln |
fmt -s -w $width && exit 0
+ have elinks && elinks -dump "$path" | head -n $maxln |
fmt -s -w $width && exit 0
;; # fall back to highlight/cat if theres no lynx/elinks
esac
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ranger-users] enhance preview script,
Liu Yubao <=