[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] How to make preview wrap long lines?
From: |
Roman Z. |
Subject: |
Re: [Ranger-users] How to make preview wrap long lines? |
Date: |
Mon, 22 Oct 2012 02:33:44 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Oct 21, 2012 at 11:59:49PM +0200, Jostein Berntsen wrote:
> On 21.10.12,22:25, Roman Z. wrote:
> > On Thu, Sep 27, 2012 at 12:46:30PM -0700, epeyys wrote:
> > > I have struggled for a day and a night trying to make preview (pager)
> > > wrap long lines. From "Dependencies" section under
> > > http://nongnu.org/ranger, I got an impression that Ranger uses "less" for
> > > pager - "A pager (<a>less</a> by default)", but having changed the
> > > following lines inside $HOME/.config/ranger/apps.py to add an "N" after
> > > "R", which will make "less" display line number, has made no difference.
> > > def app_pager(self, c):
> > > return 'less', '-R', c
> > >
> > > By looking around codes under /usr/share/pyshared/ranger/, I guess Ranger
> > > default uses an embedded pager. So my question is how I can turn on wrap
> > > inside this default pager.
> > >
> > > There are two screenshots on Ranger's main websites, one shows
> > > wrap-enabled, one doesn't.
> > > No wrap: http://nongnu.org/ranger/screenshots/screenshot0.png
> > > Has wrap:
> > > http://download.savannah.gnu.org/releases-noredirect/ranger/screenshot2.png
> >
> > This screenshot has no word wrapping.
> >
> > >
> > > I am using Ubuntu 12.04, and Ranger version is "ranger 1.5.2 (stable)".
> > > Thank everyone for this great product.
> >
> > You can wrap words by using scope.sh ("man ranger" and search for "scope").
> > A command like
> >
> > fmt -s -w "$width"
> >
> > does word wrapping, so you can simply pipe the text through it. If you
> > got the program "highlight", for example, then just replace the line
> >
> > highlight --out-format=ansi "$path" | head -n $maxln
> >
> > with
> >
> > highlight --out-format=ansi "$path" | head -n $maxln | fmt -s -w "$width"
> >
>
> I entered this in scope.sh, but it does not seem to work.
>
>
> Jostein
>
Try
text/* | */xml)
highlight --out-format=ansi "$path" -WJ "$width" | head -n $maxln
success && exit 4
cat "$path" | fmt -s -w "$width"
exit 0;;
hut