1

When I type vim filename, vim opens and I edit the file. When I close it, the part of file that was present on the display while I was in vim still shows up at the display, and all the previous terminal display gets scrolled up. How to make sure that When I close the file, the complete text from the file is gone , and I see the teminals' command/output that was previously present ?

I saw a lot of answers for this question already, and i tried the following things (but none of them is working) :

1) export TERM=xterm in .bashrc

2) altscreen on in .screenrc

3) set t_ti="" in .vimrc

I tried all these things, even tried without screen but none of them is working. Can anyone let me know how to solve this issue ? Also let me know if it is the settings in .vimrc or .screenrc or .bashrc which affect this behaviour and under what conditions (if we have these settings in all the 3 files which will take precedence) ? Any pointers to links/docs explaining this will be really useful.

Community
  • 1
  • 1
mezda
  • 3,537
  • 6
  • 30
  • 37
  • Clearing `t_ti` in vim sounds like it would do the opposite of what you want. – melpomene Nov 26 '16 at 10:19
  • See http://stackoverflow.com/questions/11023929/using-the-alternate-screen-in-a-bash-script for more information. – melpomene Nov 26 '16 at 10:21
  • @melpomene : i have commented 'set t_ti="" ' now, but even then this value is cleared by default when i check using 'echo $t_ti '. Can you please let me know to what value t_ti should be set to then. – mezda Dec 18 '16 at 07:50
  • What terminal emulator are you using (is it actually xterm or something else)? – melpomene Dec 18 '16 at 17:47
  • @melpomene i have set "export TERM=xterm" in my .bashrc file – mezda Dec 22 '16 at 20:04
  • Irrelevant. What terminal emulator are you actually using? – melpomene Dec 22 '16 at 23:20
  • @melpomene : i am using putty to ssh into my freebsd VM. And the issue comes even if i remove my .vimrc, .screenrc & .bashrc files. So it is some default setting somewhere which is causing this issue. – mezda Apr 07 '17 at 19:22

2 Answers2

0

FreeBSD has altscreen disabled by default in "xterm". But they provide "xterm-clear" with the setting enabled:

export TERM=xterm-clear
Simon Perepelitsa
  • 20,350
  • 8
  • 55
  • 74
-1

In vim, you also need to set t_te:

set t_ti= t_te=
chepner
  • 497,756
  • 71
  • 530
  • 681
  • i added the above line in .vimrc, but still the issue remains as it is. please let me know if there is anything else that i can try. – mezda Nov 26 '16 at 09:59