Neither less
or less -X
clear screen on exit. At the same time, vim
does....
Env iTerm2, protocol mosh, server Centos + tmux + zsh
iTerm2: report term as xterm-256color
tmux: set -g terminal-overrides 'xterm*:smcup@:rmcup@'
, no change to alternate-screen
$TERM
is final set to screen-256color
I also tried
tput smcup | od -c
and
tput rmcup | od -c
suggested here. It outputs correct answer.
smcup
andrmcup
intmux
, and now they're not working? That seems to be expected. – Mikel Sep 19 '14 at 02:46set -g terminal-overrides 'xterm*:smcup@:rmcup@'
in my .tmux.conf. less -X still doesn't clear screen. – Jiesi Luo Sep 19 '14 at 15:52less -X
isn't supposed to clear the screen. What happens without the-X
option? – Mikel Sep 19 '14 at 15:54less -X
clear the screen whileless
not? Anyway, I testedless
, it still didn't work. So basicallyless
andless -X
both don't clear screen in any case I tested. – Jiesi Luo Sep 19 '14 at 15:56less
sendssmcup
on startup, andrmcup
on exit, so after you quitless
, you are taken back to your shell and can see your shell output but not what you were viewing inless
. The-X
flag disables sending those terminal escapes, so theless
output is mixed in with your shell output. – Mikel Sep 19 '14 at 16:02less
still doesn't work here? – Jiesi Luo Sep 19 '14 at 16:18type less
,echo $LESS
endecho $LESSOPEN
? – jimmij Sep 19 '14 at 16:33less -+X somefile
clear the screen? – Gilles 'SO- stop being evil' Sep 19 '14 at 21:24@jimmij
– Jiesi Luo Sep 19 '14 at 23:50type less
:less is an alias for less -R less is /usr/bin/less
;$LESS
is-F -g -i -M -R -S -w -X -z-4
.$LESSOPEN
is| /usr/bin/env lesspipe.sh %s 2>&-
$LESS
less somefile will clear screen on exit. I don't know whyless -+X
doesn't work when$LESS
is set though.. It should looking from man page.. Maybe a bug forless
– Jiesi Luo Sep 19 '14 at 23:58-X
there as I suspected, so basically you startedless -X
all the time. – jimmij Sep 20 '14 at 10:58