Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: clear terminal after display of less, <, and apropos



On Oct 14, 11:33pm, Roland Jesse wrote:
} Subject: clear terminal after display of less, <, and apropos
}
} Whenever I display some information with '< blurb' the terminal gets
} cleared immediately after I quit the pager (more). The same happens after
} executing an 'apropos' command.

This is a termcap thing.  Often the "start visual mode" sequence in the
termcap will include a "switch to alternate screen" escape code; this
is often true for xterm.  Programs like vi (and clones), more, and less
may read this sequence from the termcap and send it to the terminal
before they begin display.  The "end visual mode" sequence then switches
back to the original screen.  This is to avoid having your scrollback
buffer filled up with the output from the pager program, but it is
sometimes annoying.  You can try setting TERM to a more primitive type
(say, vt100 instead of xterm) to prevent it from happening:

% TERM=vt100 apropos intro

You can change TERM permanently:

[[ "$TERM" == xterm* ]] && TERM=vt100

Or you can alias specific commands to use the primitive terminal type:

[[ "$TERM" == xterm* ]] && {
    alias less='TERM=vt100 less'
    alias more='TERM=vt100 more'
    alias apropos='TERM=vt100 apropos'
    alias man='TERM=vt100 man'
}

(That won't help with '< blurb' because READNULLCMD has to be a single
word.  So you can also do (after creating the above aliases):

function readnullcmd { less $* }
READNULLCMD=readnullcmd

to get the terminal setting there as well.)

Or you can read up on termcap and terminfo and figure out how to create
a new description for your terminal that omits the start/end visual mode
sequences.

} The situation is a bit different for less:
} 
} j.wh4-422 ~ % less blurb
} zsh: command not found: lesspipe.sh

It looks from that error as if "less" on your system is not an actual
executable, but instead is some kind of a shell script.  There's not
much help we can give you in that case.  Try:

% whence -a less

to see if there's already an alias or function causing your confusion.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author