Posts Tagged ‘less’
less
I’ve finally sorted out some irritating little niggles in my environment. I’ll note them here for reference. I usually log in from my 10.4 Mac to a Linux machine.
The first problem was that lines would run off the top of the screen, Linux didn’t seem to know what size my terminal window was. I solved that by changing my default terminal type to ansi – the default on the Mac seemed to be xterm-color, whatever that is.
The second problem was that less wouldn’t show man pages properly; bold text would mess up the formatting. That went away when I added less’s r option to my LESS variable. The “r” option allows escape sequences to pass straight through less instead of being altered by less to remove their effect – so things like bold text would finally show up bold rather than normal but surrounded by a weird jumble of characters put in by less to replace vanished escape sequences.
So I could finally view man pages, which was great; but then the first problem started up again: less would sometimes run some lines off the top of the screen, apparently trying to show me too many lines. A hunt through the less man page provided the answer: I shouldn’t have used less’s r option. I should instead have used the R option, which allows ANSI Escape sequences through to set colour, bold text and so on, but blocks all other escape sequences. That seems to have been the final piece of the puzzle – less is now a well-behaved citizen. So I can now stop footering about with this sort of rubbish and get on with some work…