Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
Updation to Title and Tags needed. Please help with same. –  mtk Jan 7 '13 at 7:44
    
Are user1 and user2 accounts on the same or different machines? –  jasonwryan Jan 7 '13 at 8:03
    
@mtk updation is not right english.stackexchange.com/questions/68169/… –  warl0ck Jan 7 '13 at 8:08
    
@jasonwryan Logging on same machine too shows same scenario. @ warl0ck Thanks for that. –  mtk Jan 7 '13 at 8:19
add comment

1 Answer

up vote 4 down vote accepted

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:

TERM=xterm; export TERM

share|improve this answer
    
+1 Exact/perfect solution. Thanks !!! Didn't thought it was that easy. Can you please elaborate on what a TERM is? or point to some resource link? I need to understand this. Does this affect only when we connect via putty? –  mtk Jan 7 '13 at 8:31
    
You can specify the terminal setting into the putty session, but users can have it specify on their environment variables. TERM will define your terminal type and also some will have more features that other, example, xterm supports colors and it will update the rows and columns automatically. If you use vt100, it will default to 24 rows by 80 columns when you resize your terminal you will see that it sticks to 24x80. Check this unix.stackexchange.com/questions/43945/…, it might explain better than me. –  BitsOfNix Jan 7 '13 at 9:01
    
It's the terminal behaviour, not the shell. The terminal emulator settings are the same whatever tool you use to connect. The difference is explained in details here: unix.stackexchange.com/questions/4126/… –  Leonid Jan 7 '13 at 9:01
    
@Leonid, not exactly, if you use putty you can define and it will update when connecting if the user does not a TERM define. If the user has it defined then you are right, not matter what tool it will prevail the setting on the user environment. –  BitsOfNix Jan 7 '13 at 9:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.