Page 1 of 3

less, Powerful Not-So-CLI (:-) Text Viewer and Launcher

Posted: Fri 13 Jan 2012, 08:20
by musher0
Edit, 19 Nov. 2015. Version 481 compiled for Puppy, here.
~~~~~~~~~~~~~~~~~
Edit, Dec. 17, 2014. Less, version 470, has been attached to message
http://murga-linux.com/puppy/viewtopic. ... ost#815558.
The new "read pdf as txt" script is in the message just above it. Enjoy! :)
~~~~~~~~~~~~~~~~~
Edit, Dec. 20, 2013. For latest compile of less version 458, please go to:
http://murga-linux.com/puppy/viewtopic. ... ost#745241
(I've deleted the version 451 that was attached to this initial post.)
Thanks.
~~~~~~~~~~~~~~~~~
Update, April 25, 2013: less-458 is out. See message at bottom of page.

Hello, all!
Here is less 4.51, dated July 2012, compiled from source. This pet includes lesspipe and numerous right-click accesses. More compact size than v. 4-44 obtained by stripping and upx'ing of executable. This one also replaces outright the "defaulttextviewer" file.

From the less viewer, if you need to edit a file, press "V" and the file will load in your text editor. You will be brought back to the less viewer upon closing your editor.

Enjoy! :)

/////////////////

Rationale:
The less included by default in Puppy is the cut-down version integrated in busybox. It does the job, barely. If you need more sophisticated viewing capacity, then you need this full version of less.

For example I've replaced Puppy's defaulttextviewer with less-4.51, with no regrets. It loads the text extremely fast, it allows you to view text -- or binary material, which leafpad, nicodedit or even geany do not load at all.

This pet also comprises (minimal) docs created by the compilation. Look for "less.hlp" under /usr/local/share/doc and view it with... less ?? :)

(You can also view the help file of less while reading any other text, simply by typing "h". After you've consulted less's help, type "q" to return to reading your initial text.)

The default text viewer has been replaced with this script:

Code: Select all

#!/bin/sh
# /usr/local/bin/defaulttextviewer
####
urxvt -fn "xft:Aerial Mono:pixelsize=13" -fg "#D8FDDB" -bg "#786849" -sr +st +tcw -bc -T "Aperçu de \"$@\"" -n "Aperçu de \"$@\"" -tr -tint black -sh 57 -bd firebrick4 -g 84x25+320+24 -cr white -b 4 -e less-444 -B -J -m -N -~ "$1"
# exec nicoedit "$@"
# or perhaps 
# exec leafpad "$@"
The above uses the transparent and xft font features of urxvt to make viewing under less "softer on the eyes". It also displays the name of the file being viewed in the title bar.

As an aside, I've got the docs in a series of 8 jpg panels for easy consultation. If there's a request, I'll make them available here also.

Have a great day!

P.S. A screenshot is included.

Posted: Wed 18 Jan 2012, 06:15
by GustavoYz
Thanks, it works like a charm.
I've to tweak some things in order to make puppy less (busybox one) work with man pages, but this full less has no issues.
Thanks again.

EDIT: I've replaced the original less symlink for an equal symlink pointing to less-444, no regrets.

Posted: Thu 19 Jan 2012, 07:20
by musher0
Hi, Gustavo.

My pleasure!

BFN.

Posted: Thu 19 Jan 2012, 07:37
by musher0
Confused by the less commands?

Here's a little script that will launch the less help at the same time as the document you want to view with less.

You can link this script as a context command in ~/.config/rox-sourceforge.net/SendTo/text_plain, for example, or any other of the directories there with text_something.

The help text will appear black on white, and the consulted text as white on black. No fancy transparency.

Enjoy!

Code: Select all

#!/bin/ash 
# /~/my-applications/bin/less-avec-aide.sh
####
urxvt -sr -g 82x24+40+40 -e less-444 --help &
urxvt -rv -sr -g 110x28 -e less-444 -B -J -m -N -~ "$@" &
Here is a screenshot.

Posted: Fri 31 Aug 2012, 09:10
by musher0
Hello, all.

A new version of less is available. Please see first post for download.

Enjoy!

Posted: Mon 03 Sep 2012, 18:21
by GustavoYz

Posted: Tue 13 Nov 2012, 19:13
by GustavoYz
:arrow: You can set options into a system variable called `$LESS`, so the next time is executed, less will use those (useful when "piping").

For example, to see a script with sintax highlights, I often use pygmentize + less on this way (I use a custom bash function with this in reality):

Code: Select all

pygmentize -l perl regex.pl | less
But, if $LESS has no '-R', it won't show colors.

The workaround is easy: add on the .bashrc somthing like this:

Code: Select all

LESS=`$LESS -r`
This way you won't loose any previous options set and add support for colors on situations like above.

My $LESS variable (bashrc adds '-r -Qai'):

Code: Select all

-M -r -Qai
:arrow: Also, less alloud you to have color on man pages (some puppies have `man`).
Check this: http://pastebin.com/SbaR33Pt

Posted: Tue 13 Nov 2012, 20:31
by musher0
Thanks for those tips, Gustavo!

Posted: Fri 26 Apr 2013, 01:21
by musher0
less-458 is just out.
Enjoy!

musher0

PS. Almost forgot:
* if this is your first install of less, you can ignore this note.
* if you already have less installed, remove all previous "less"-related files (such as lesskey, lessopen) with pfind before you install this version. The executables of this version are entirely in /usr/bin, and we don't want interference from earlier versions, right ? :)
In particular remove any previous versions you may have in /usr/local/bin or /root/my-applications/bin.
Also, it's not fresh to my mind, but I believe BK has a "less" linked to busybox in /bin in some Puppies. Never remove BK stuff from a Puppy; simply rename it to "less-NO", or something like that. The new 458 full version will then have full precedence, and there will be no confusion in the system.
Thanks.

Posted: Fri 26 Apr 2013, 05:51
by tallboy
Hi musher0
I downloaded less_458 to my LupuPlus_5.2.8. As you mentioned, the existing /usr/bin/less was a link to busybox.

Less only flashed on the screen for a fraction of a second when I tried it.

Code: Select all

# less my-documents/growisofs.txt 
less: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
tallboy

Posted: Fri 26 Apr 2013, 14:16
by musher0
Hi, tallboy.

Ah ? I compiled this version in wheezy 3.5.2.5. Strange...

But it's normal, in a way, because less needs "food", it does indeed sort of flash and close if it does not have any text to show.

Re-reading your message, I see that you did give it "food". Ok, I'll do another compile on lupu 5.28 specifically.

musher0

Posted: Fri 26 Apr 2013, 14:17
by musher0
To test "less" :

Does the following show in a console window or just flashes?

Code: Select all

echo beebabelooba > /tmp/bebop.txt;urxvt -e less -~ /tmp/bebop.txt
# Or any other *.txt file, of course. Or
#
# urxvt -e less --help
# if this last one, type G to go to the end of the help file, and 
# small-case g to come back to top, to see if it reacts properly.
If the text shows, it works, obviously. :)

musher0

Posted: Fri 26 Apr 2013, 14:52
by musher0
@tallboy and others who might be experiencing library problems with the wheezypup build of less above:

please try this one, compiled on Small Business Pup (SBP) by e_mattis, a derivative of lupu 5.28.

Tests were ok on my lupu. Reports appreciated if not on your machine.

The less-458 version and the libtinfo.so.5.7 library are presented separately. You'll need both for less-458 to work on lupu 5.28.

Enjoy.

musher0

Note. The attached libtinfo library pet was extracted from this package: http://pkgs.org/centos-6-rhel-6/centos- ... /download/.

Posted: Sat 27 Apr 2013, 01:15
by tallboy
Hi musher0.
The /root/my-applications/bin/ directory containing 4 scripts in the original less_458.pet package, is not present in the less_458lupu version.

Will there be any problems if I just copy the scripts into /my-applications/bin? Any hardcoding with references?

tallboy

Posted: Sat 27 Apr 2013, 04:09
by musher0
tallboy wrote:Hi musher0.
The /root/my-applications/bin/ directory containing 4 scripts in the original less_458.pet package, is not present in the less_458lupu version.

Will there be any problems if I just copy the scripts into /my-applications/bin? Any hardcoding with references?

tallboy
Hi, tallboy.

Chucks... :(
Thanks for telling me.
No, no problem at all with your suggestion. :) Just with my focus...

So I redid the pet for lupu. See above.

BFN.

musher0

Posted: Sat 27 Apr 2013, 04:55
by tallboy
musher0 wrote:Just with my focus...
Do you actually try to convince us that you're not an industrial robot?? :lol: :lol: :lol:

tallboy

Posted: Sat 27 Apr 2013, 05:59
by tallboy
Hi again musher0
I renamed the original /usr/bin/less to less-old, it is a link pointing to /bin/busybox.

I still get a message after running less in a urxvt window:
# less --help
less: Symbol `ospeed' has different size in shared object, consider re-linking
There is no file named ospeed, but when I search with pfind for the standalone word ospeed in text, the search give two results: /bin/busybox and /bin/stty.

Do you know what this is?

tallboy

Posted: Sat 27 Apr 2013, 15:37
by musher0
Hi, bzzt, bzzt, Tallboy.

No idea, bzzt, bzzt. :lol:

musher0

PS. There are mentions here:
http://www.info.com/searchw?qkw=ospeed& ... &qhqn=&KW=
Related to perl or tput ? I am afraid I can be of no help.

Posted: Sat 27 Apr 2013, 17:41
by GustavoYz
Something is overwriting ncurses ospeed, so less (and probably other programs as well) raise that error.
If you have installed Mono in your system, may have that problem.

Posted: Sat 27 Apr 2013, 19:10
by tallboy
Thank you for that info, GustavoYz
I don't find Mono in my system.

Message: Symbol `ospeed' has different size in shared object, consider re-linking

I removed the original less symlink that pointed to busybox, could that be a clue? (the same message came when I just renamed the link)

What does ospeed do?

tallboy