[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] enhance preview script
From: |
Roman Z. |
Subject: |
Re: [Ranger-users] enhance preview script |
Date: |
Wed, 16 Feb 2011 14:28:02 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi.
Good idea to use fmt, I was looking for a tool like fmt but didn't find
for some reason :)
Thanks for the patch, I applied it now, finally
Regards,
Roman
On Sun, Jan 30, 2011 at 10:34:39AM +0800, Liu Yubao wrote:
> [[ 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
>
- Re: [Ranger-users] enhance preview script,
Roman Z. <=