[comp.unix.misc] WANTED: File scroller similar to less but with more features

magrw@levels.sait.edu.au (02/20/91)

X-NEWS: levels comp.unix.questions: 11109
Path: levels!magrw
From: magrw@levels.sait.edu.au
Newsgroups: comp.unix.questions
Subject: WANTED: File scroller similar to less but with more features
Message-ID: <15903.27c29273@levels.sait.edu.au>
Date: 20 Feb 91 15:14:59 GMT
Organization: University of South Australia
Lines: 22

I am looking for a file scroller similar to less, but with as many of the
following features as possible:

        (1)     CASE-INSENSITIVE string search

        (2)     Intelligent usage of VT100 (and/or VT220) keys such as:
                        (i)     Cursor keys for moving around the file
                        (ii)    PrevScrn (instead of b)
                        (iii)   NextScrn (instead of space bar)

I need this to run on both a Sun SPARCserver 490 as well as a DECstation 5000
(running Ultrix).


All replies gratefully accepted via either email or this newsgroup.


Thanks.


George Wiley
MAGRW@LV.SAIT.EDU.AU

bhoughto@pima.intel.com (Blair P. Houghton) (02/21/91)

In article <15904.27c2939a@levels.sait.edu.au> magrw@levels.sait.edu.au writes:
>        (1)     CASE-INSENSITIVE string search
>        (2)     Intelligent usage of VT100 (and/or VT220) keys such as:
>                        (i)     Cursor keys for moving around the file
>                        (ii)    PrevScrn (instead of b)
>                        (iii)   NextScrn (instead of space bar)
>I need this to run on both a Sun SPARCserver 490 as well as a DECstation 5000
>(running Ultrix).

Off the top of my head:

Try using vi(1), calling it with the name 'view' so it's
automatically read-only.  It automatically handles (i).

Use the following in your setup to take care of (1), (ii) and (iii)
(^F is ctrl-F, which you can get into a file by typing ^V^F
and similarly for ^B and ^M):

	:set ic
	map [6~ ^F
	map [5~ ^B
	map q :q!^M
	map N :n

add these if you still want to use b, f, and the space-bar

	map f ^F
	map b ^B
	map ^V  ^F	(ctrl-V ctrl-V space space ctrl-V ctrl-F)

The setup should appear in a .exrc file, or in your EXINIT
environment variable as

	set ic|map [6~ ^F|map [5~ ^B|map q :q!^M|map N :n

If you want to hide all this and still use your
.exrc for vi(1), alias 'less' and 'vi' as follows
(put the following line in a file and source the file
to set it, or put it in your .cshrc; csh(1) gets confused
by the ^M -- which is a ctrl-M, not an upcaret and an M --
when it sees it on the command-line.):

  alias less 'setenv EXINIT "set ic|map [6~ ^F|map [5~ ^B|map q :q\\!^M";view'
  alias vi 'unsetenv EXINIT; vi'

to use .exrc, or

  alias vi 'setenv EXINIT ...; vi'

where ... is your usual EXINIT, if you prefer EXINIT over .exrc.

You can't pipe to them, but less(1) has its problems with
stdin, too, so you shouldn't pipe to it without some
restrictive suppositions about your file, either.

You also lose some things like flipping back and forth
between files using N and B. (N is easy; B is a pain to
deal with in vi(1)).

But you gain, since you're in the editor, if you want
to make a change.  Just use :unmap to turn off some
of these things (editing would be a mess if you didn't)
and use :w! to write the changes.

				--Blair
				  "Yeh.  Like I'd want to start
				   Emacs every time I wanted to
				   flip through the funnies..."

Dan_Jacobson@ATT.COM (02/21/91)

>>>>> On 20 Feb 91 15:19:53 GMT, magrw@levels.sait.edu.au said:

magrw>         (1)     CASE-INSENSITIVE string search

perhaps check out GNU Emacs view mode.

magrw>         (2)     Intelligent usage of VT100 (and/or VT220) keys such as:
magrw>                         (i)     Cursor keys for moving around the file
magrw>                         (ii)    PrevScrn (instead of b)
magrw>                         (iii)   NextScrn (instead of space bar)

In GNU Emacs you can bind the keys every which way, for me Keypad 8 =
up one screen. Keypad 2 =down 1 screen.

I do admit that I havent got around to doing "emacs -f functionX *"
vs. "less *", where functionX makes view mode the default mode... etc.
-- 
Dan_Jacobson@ATT.COM  Naperville IL USA  +1 708-979-6364

tchrist@convex.COM (Tom Christiansen) (02/21/91)

From the keyboard of magrw@levels.sait.edu.au:
:X-NEWS: levels comp.unix.questions: 11109
:Path: levels!magrw
:From: magrw@levels.sait.edu.au
:Newsgroups: comp.unix.questions
:Subject: WANTED: File scroller similar to less but with more features
:Message-ID: <15903.27c29273@levels.sait.edu.au>
:Date: 20 Feb 91 15:14:59 GMT
:Organization: University of South Australia
:Lines: 22
:
:I am looking for a file scroller similar to less, but with as many of the
:following features as possible:
:
:        (1)     CASE-INSENSITIVE string search

less -i 

:        (2)     Intelligent usage of VT100 (and/or VT220) keys such as:
:                        (i)     Cursor keys for moving around the file
:                        (ii)    PrevScrn (instead of b)
:                        (iii)   NextScrn (instead of space bar)

Sounds like you need to look at lesskey(1).

--tom
-- 
"UNIX was not designed to stop you from doing stupid things, because
 that would also stop you from doing clever things." -- Doug Gwyn

 Tom Christiansen                tchrist@convex.com      convex!tchrist

jpr@jpradley.jpr.com (Jean-Pierre Radley) (02/24/91)

In article <15904.27c2939a@levels.sait.edu.au> magrw@levels.sait.edu.au writes:
>
>I am looking for a file scroller similar to less, but with as many of the
>following features as possible:
>
>        (1)     CASE-INSENSITIVE string search
>
>        (2)     Intelligent usage of VT100 (and/or VT220) keys such as:
>                        (i)     Cursor keys for moving around the file
>                        (ii)    PrevScrn (instead of b)
>                        (iii)   NextScrn (instead of space bar)
>
>I need this to run on both a Sun SPARCserver 490 as well as a DECstation 5000
>(running Ultrix).

You don't state what revision of 'less' you are using. I have v.123 here, and
it does all the things you ask for.

I've run it on assorted versions of SCO XENIX, and on SCO UNIX 3.2.2

 Jean-Pierre Radley   NYC Public Unix   jpr@jpradley.jpr.com   CIS: 72160,1341

wwm@pmsmam.uucp (Bill Meahan) (02/25/91)

In article <1991Feb23.183717.26164@jpradley.jpr.com> jpr@jpradley.jpr.com (Jean-Pierre Radley) writes:
>In article <15904.27c2939a@levels.sait.edu.au> magrw@levels.sait.edu.au writes:
>>
>>I am looking for a file scroller similar to less, but with as many of the
>>following features as possible:
>>
>>        (1)     CASE-INSENSITIVE string search
>>
>>        (2)     Intelligent usage of VT100 (and/or VT220) keys such as:
>>                        (i)     Cursor keys for moving around the file
>>                        (ii)    PrevScrn (instead of b)
>>                        (iii)   NextScrn (instead of space bar)
>>
>>I need this to run on both a Sun SPARCserver 490 as well as a DECstation 5000
>>(running Ultrix).
>
>You don't state what revision of 'less' you are using. I have v.123 here, and
                                                                 ^^^

Holy Cow!  I just picked up less-97 a week or two ago!  Where IS version 123?
Is this an "official" release or some local hack?


>it does all the things you ask for.
>
>I've run it on assorted versions of SCO XENIX, and on SCO UNIX 3.2.2
>
> Jean-Pierre Radley   NYC Public Unix   jpr@jpradley.jpr.com   CIS: 72160,1341

I assume this version is not Intel specific!?!
-- 
Bill Meahan			|Product Design & Testing Section
Production Test Engineer	|Starter Motor Engineering
wwm@pmsmam			| +1 313 484 9320

tempest@ecst.csuchico.edu (Kenneth K.F. Lui) (02/26/91)

In article <1991Feb25.124408.5177@pmsmam.uucp> wwm@pmsmam.UUCP (Bill Meahan) writes:
>Holy Cow!  I just picked up less-97 a week or two ago!  Where IS version 123?
>Is this an "official" release or some local hack?
>

You can ftp v123 from scam.berkeley.edu.  There's another cool
version of less named "less v123magic" that has a uses a config
file which determines what type of file it's reading and can run
another program or programs before displaying it (i.e. you can
say "less foo.Z" and v123magic will run uncompress before
displaying foo).

I have no idea where to get source for this version.  I use it at
work, but only the binaries are available, so it may be an
internally-modified version.


Ken
______________________________________________________________________________
tempest@ecst.csuchico.edu, tempest@walleye.ecst.csuchico.edu,|Kenneth K.F. Lui|
tempest@sutro.sfsu.edu, tempest@wet.UUCP                     |________________|

jpr@jpradley.jpr.com (Jean-Pierre Radley) (02/27/91)

In article <1991Feb25.124408.5177@pmsmam.uucp> wwm@pmsmam.UUCP (Bill Meahan) writes:
>In article <1991Feb23.183717.26164@jpradley.jpr.com> jpr@jpradley.jpr.com (Jean-Pierre Radley) writes:
>>You don't state what revision of 'less' you are using. I have v.123 here, and
>
>Holy Cow!  I just picked up less-97 a week or two ago!  Where IS version 123?
>Is this an "official" release or some local hack?

Less 123 is dated 8.31.89 by Mark Nudelman, whose name has been on the source
code all along, so I'd say it's "official".

>>I've run it on assorted versions of SCO XENIX, and on SCO UNIX 3.2.2
>I assume this version is not Intel specific!?!

No. It has assorted makefiles for dos and various *nix.

 Jean-Pierre Radley   NYC Public Unix   jpr@jpradley.jpr.com   CIS: 72160,1341