After vim quits, the contents of the file are still displayed.

  question, vim

Use: q! After exiting vim editing, the contents of the previous files remain on the screen, like this
图片描述

The following external command line has already appeared, but the contents of the previous files are still displayed.
Although ctrl+l can be used to clear the screen, can the contents of those files not be displayed directly?

First method

Set the TERM environment variable to xterm or xterm-color, which can be added to the. bashrc file:export TERM=xterm-color

The second method

Set the values of the t_ti and t_te variables of vim (optional, not required on CentOS, for example)

Use vim to open a file, enter: set t_ti or: set t_te in normal mode, if the values are similar: “[[? 1049h” and “^[[? 1049l “,then you need to add the following lines to. vimrc:

if &term =~ "xterm"
 " SecureCRT versions prior to 6.1.x do not support 4-digit DECSET
 "    let &t_ti = "\<Esc>[?  1049h"
 "    let &t_te = "\<Esc>[?  1049l"
 " Use 2-digit DECSET instead
 let &t_ti = "\<Esc>[?  47h"
 let &t_te = "\<Esc>[?  47l"
 endif

This should solve the problem.