VIM(运行时)如何向终端显示文件内容,然后(关闭时)可以显示回显示的内容?我已经有几个应用程序,我希望实现这个功能...就像制作一个带终端图形的程序时,整个屏幕通常必须在单个"对象"移动时更新.
Joh*_*ski 10
这是你的终端存储旧的缓冲区,而不是Vim.
如果您使用XTerm仿真,Vim会在启动时切换到"备用"终端屏幕.退出时,Vim切换回正常屏幕.
启动时的Terminfo字符串:
\E7 saves the cursor's position
\E[?47h switches to the alternate screen
Run Code Online (Sandbox Code Playgroud)
退出时的Terminfo字符串:
\E[2J clears the screen (assumed to be the alternate screen)
\E[?47l switches back to the normal screen
\E8 restores the cursor's position.
Run Code Online (Sandbox Code Playgroud)