0

Every time after I exit Vim, it looks like the "clear" command is called automatically in the shell. Everything left on the screen is a new command line for input.

More exactly, it seems that Vim shares the same terminal with shell. After exiting Vim, the shell commands and their output are pushed pages up, and a "clear" must be called, because otherwise the content in Vim will remain on the screen.

With man and less, there is no such problem. After exiting, the screen returns what it is before running man and less. What can I do so that Vim could act like this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
enjoynet
  • 1
  • 1
  • Possible duplicate of [How to Not Overwrite Previous Terminal Contents](http://stackoverflow.com/questions/31628932/how-to-not-overwrite-previous-terminal-contents) – Dan Lowe Oct 27 '15 at 23:39
  • What terminal emulator are you using, and what is its terminal environment variable set to (`$TERM`)? Typically there would be no need for such interventions with xterm terminal emulators. – timss Oct 29 '15 at 14:11

1 Answers1

0

You can edit ~/.vimrc and add into it set t_ti= t_te=.

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Viorel Mirea
  • 371
  • 3
  • 6
  • After adding this, no "clear" any more. But since vim and shell share the same terminal, now the contents of vim are left on the screen. Go up several pages, I can see the screen before opening vim. – enjoynet Oct 28 '15 at 17:47