当在 gnu 屏幕中使用 vim 或 less 时,退出 vim 或 less 会留下挥之不去的印记

发布于 2024-08-19 13:48:09 字数 153 浏览 2 评论 0原文

在我的新 Ubuntu 系统上,我启动一个屏幕会话并在 vim 中编辑文件或在 less 中查看它。退出后,屏幕不会自行重绘,而只是向上滚动以在我刚刚在 vim 或更少中查看的所有内容下显示命令行。

我怎样才能改变这个,以便退出 vim 会让我返回到调用 vim 之前的屏幕?

On my new Ubuntu system, I start a screen session and edit a file in vim or view it in less. After I quit, the screen doesn't redraw itself, but simply scrolls up to show a command line under all the stuff I was just viewing in vim or less.

How can I change this so that quitting vim will return me to the screen the way it was before I invoked vim?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤星 2024-08-26 13:48:09

screen 的 altscreen(备用屏幕)功能默认处于关闭状态。

将其添加到您的 .screenrc 中:

altscreen on

请参阅:http ://www.gnu.org/software/screen/manual/screen.html#Redisplay

screen's altscreen (alternate screen) feature is turned off by default.

Add this to your .screenrc:

altscreen on

See: http://www.gnu.org/software/screen/manual/screen.html#Redisplay

她如夕阳 2024-08-26 13:48:09

这是由于您的 termcap for screen 不完整造成的。 (这似乎是一个非常常见的问题。)Vim 不知道恢复屏幕的顺序,所以它只是保持原样。

您可以通过将 vim 的 term 选项(或启动 vim 之前的 TERM 环境变量)设置为“屏幕兼容”的终端(例如 xterm)来解决此问题。例如:

TERM=xterm vim

或(在vim中):

:set term=xterm

您可以将vim中的t_tit_te选项设置为正确的代码。请参阅 vim 中的 :help xterm-screens 了解更多详细信息。

This is caused by your termcap for screen being incomplete. (This seems to be a really common problem.) Vim doesn't know the sequence for restoring the screen, so it just leaves it like it was.

You can work around this problem by setting vim's term option (or the TERM environment variable before you start vim) to a terminal that's "screen compatible", like xterm. eg:

TERM=xterm vim

or (in vim):

:set term=xterm

You can set the t_ti and t_te options in vim to the right codes. See :help xterm-screens in vim for more details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文