Some terminals can be restored to the status of the terminal before vim is enabled after Vim is exited, similar to the following:
$ Vim/etc/sysconfig/
#### Enable Vim #####
Sdskk, some file content
: Q
$ Vim/etc/sysconfig/# restore the terminal to the previous state
But some cannot solve the problem. The following two steps are required:
1. Set the TERM environment variable to xterm or xterm-color. You can add: export term = xterm-color to the. bashrc file.
2. Set the values of the t_ti and t_te variables of VIM (optional, for example, not required on centos)
Use Vim to open a file. In normal mode, enter: Set t_ti or: Set t_te. If the value is similar:"^ [[? 1049 H "and" ^ [[? 1049l ", then you need to add the following lines in. vimrc:
If & term = ~ "Xterm" "securecrt versions prior to 6.1.x do not support 4-digit decset" Let & t_ti = "\ <ESC> [? 1049 H "" Let & t_te = "\ <ESC> [? 1049l "" use 2-digit decset Instead let & t_ti = "\ <ESC> [? 47 H "Let & t_te =" \ <ESC> [? 47l "endif
From: http://forums.vandyke.com/showthread.php? T = 3431
This should solve the problem.
In addition, some friends like to use screen for multi-screen management. If you want this effect, you need. add a line of altscreen on to the screenrc configuration file. If it is a root user, you can edit/etc/screenrc, find altscreen, and cancel the preceding comment.