vim - vim怎么显示到终端然后取回?

标签 vim terminal

VIM(运行时)如何将文件内容显示到终端,然后(关闭时)可以取回显示的内容?我已经制作了几个应用程序,我希望在其中实现此功能……例如在制作带有终端图形的程序时,通常在单个“对象”移动时整个屏幕都必须更新。

最佳答案

存储旧缓冲区的是您的终端,而不是 Vim。

如果您使用 XTerm 仿真,Vim 会在启动时切换到“备用”终端屏幕。退出时,Vim 切换回正常屏幕。

启动时的 Terminfo 字符串:

\E7 saves the cursor's position 
\E[?47h switches to the alternate screen 

退出时的 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. 

关于vim - vim怎么显示到终端然后取回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4514473/

相关文章:

vim - 如何在 ViM 中撤消 C-s C-x?

linux - 在后台执行 bash 脚本?

macos - 英国 mac 终端中的 Meta 和 #

java - 如何在 Apache Felix Gogo shell 上清屏?

session - RDP session 打开时检测客户端计算机名称

java - 在java中运行系统命令

vim - 如何使用vim对.html文件进行无效的语法检查

vim - 如何设置默认的vim配色方案

vim - 需要一个脚本来模拟在插入模式下按下 <cr>

regex - 在 Vim 中用  ‘&’ 替换  ‘\’ 不在行尾且前面没有  ‘\&’