分享

terminal

 jatxl3 2020-08-06

My question is simple, but I am finding it hard to frame/explain it easily.

I log into several Unix boxes with different accounts. I see 2 different things for user1 and user2, while editing text files in vim

user1

When I type vim filename, vim opens and I edit the file. When I close it, the complete text from the file is gone , and I see the Teminals' command/output that was previously present.

user2

When I type vim filename, vim opens and I edit the file. When I close it, the part of file that was present on the display while I was in vim still shows up at the display, and all the previous Terminal display get's scrolled up. Even if the file was just 1 line, after exiting vim, the display shows the first line, with rest all the ~ and I see the command prompt at the bottom of screen.

Details

$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
$ vim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 12 2009 07:08:36)

I compared the vimrc files for both users, and I am aware of all the settings, and don't find any setting/config related to this behavior.

Is this behavior related to shell config ? How do I set the things, so that I get the behavior as shown in user1 scenario?

I am not able to describe this easily, also finding it hard to google, as I don't to know what keyword to look for such behavior. Let me know, If I should elaborate further.One of the reasons for that behaviour will be the setting of the terminal for each user.

For example:

  • User1 is using TERM=xterm, in this case when you exit vim it will clear the terminal.
  • User2 is using TERM=vt100, in this case when you exit vim it will not clear the terminal.

Check what terminal user1 is using with echo $TERM and set the same for user2. for bash:Such behavior was the only thing that kept me away from using screen. It uses "screen" terminal and changing it to "xterm" didn't help.

Adding altscreen on option in ~/.screenrc solved it. From screen's manual:

altscreen on|off

If set to on, "alternate screen" support is enabled in virtual terminals, just like in xterm.  Initial setting is `off'.
answered Nov 10 '16 at 4:12
  • @Fox OP doesn't mention anything about TERM he is using, so this can be just alternative answer. Anyway this page is on very top while googling for screen issue too. – BartBiczBoży Nov 10 '16 at 7:16
  • 2
    This did the trick! Keywords: "vim quit leaves visual artifacts terminal" – Jay Taylor Dec 21 '17 at 17:53
  • Perfect. Works with nano, htop and etc. Why isn't this the default? – ctrlbrk Jun 20 at 16:44

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多