0

My question is similar to: https://unix.stackexchange.com/questions/60499/how-to-set-the-bash-display-to-not-show-the-vim-text-after-exit but the accepted answer doesn't work in my case.

My question is exactly opposite to Keeping view of edited file after exiting vim

I do not want to keep the file content on console after the file is closed through vi. => echo $TERM prints xterm I also did (not required though):

TERM=xterm;export TERM

=> $HOME/.vimrc doesn't exist, so i created one and set t_ti="" and later also tried set t_te="" but didn't work

=> When i open a file, if i !echo t_te or t_ti or t_ks it all prints nothing

=> I'm on Linux 3.10.0 with Vi Improved 7.4, using Tectia

anurag86
  • 1,635
  • 1
  • 16
  • 31
  • 1
    The linked answer tells you to set `t_TI` and `t_TE` to empty values to *disable* the alternate screen feature. If you want that feature, it doesn't make sense to do something that *disables* it, don't you think? – romainl Jun 04 '21 at 13:39
  • `!echo t_te` wouldn't print the value of the option. Try `:set t_ti` and `:set t_te` – William Pursell Jun 04 '21 at 15:08
  • @romainl : I read lot of answers including https://vi.stackexchange.com/questions/432/prevent-vim-from-clearing-the-terminal-after-exit which says to _prevent _ clearing the screen set the values to ^[[?1049h Perhaps thats the reason i set to empty. If not empty what should i set to and where, because i tried setting it to ^[[?1049h too and it didnt work – anurag86 Jun 04 '21 at 15:10
  • @WilliamPursell : I opened a file in vim, and :set t_ti and :set t_Te sets the value to ^[[?1049h and ^[[?1049l respectively. I came out use :q and still the same problem – anurag86 Jun 04 '21 at 15:13
  • It looks like they are not empty, then. Perhaps you clear them in .vimrc but they later get written by another startup file (eg, a filetype startup in ~/.vim/after). – William Pursell Jun 04 '21 at 15:16
  • Note that `:set t_ti` does not set the value, it just displays what the value is. If you want to set it, you would use `:set t_ti=...` – William Pursell Jun 04 '21 at 15:17
  • No, i didn't touch .vimrc. I had set to "" in the terminal. But when i open a file and :set t_ti and t_te it shows the values are not empty. ~/.vim/after doesn't exist. What should i do – anurag86 Jun 04 '21 at 15:48
  • The correct values for `t_TI` and `t_TE` depend on your terminal and your `$TERM`. Vim sets them automatically during startup based on the capabilities advertised by your terminal via its `$TERM` so arbitrarily setting them to random values found online will get you nowhere. If they are empty, it is because Vim got no response when it asked your terminal about those capabilities. This may be caused by a faulty terminal description, a bug in Vim, an option of your terminal emulator, etc. Messing around in Vim is not the right strategy, here, and SO is not the right place. Try superuser instead. – romainl Jun 04 '21 at 16:04

0 Answers0