KalyanChakravarthy.net

Thoughts, stories and ideas.

Getting rid of Alternate Screen

... or simply making the damn terminal content persist when I seek any form of --help or run git diff.

I don't know whoever thought or why they thought that alternate screen was a sane idea is beyond me. I'd do a git diff to check my commits and promptly forget the specifics by the time I get to writing the commit message. Same with the python REPL's help function. The frustration was the kind that builds up like a thousand paper cuts, each seemingly an insignificant occurrence, only day you suddenly find yourself quadriplegic. It doesn't make any sense.

By changing OSX's terminal from xterm-256 to vt100 (Preferences → Profiles → Advanced → 'declare terminal as') I have been delivered into the sweet arms of salvation and from inflicting cuddles of frustration on my cat that has been patient (for a cat) with me through this ordeal.

Am writing this down here because I seem to run into this every few years and promptly forget how I ever managed to get rid of this pest. No more alternate screen, no more, not until this blog and OneNote chose to go away atleast.

Update 1: Oh god, that was terrible in its own right with vim becoming color blind, which sent down on yet another wild goose chase. So the next solution is to configure the pager, which you better hope is less everywhere

export LESS="-iMFXRj4a"

Now the side effect has been magical of man pages and --help now showing up line numbers! I'd call this a success (for now).

Reference and further reading

  1. http://www.shallowsky.com/linux/noaltscreen.html
  2. https://hints.macworld.com/article.php?story=20110905185128781
  3. https://superuser.com/questions/136162/how-can-i-still-see-the-man-text-after-i-quit-man/136167#136167