Resume terminal content after Vim exits

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.