Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Secure Shell

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2012, 05:15 AM
raveendrajoshi raveendrajoshi is offline
Registered User
 
Join Date: Jul 2012
Posts: 4
SecureCRT SSH2 login to Linux - Vi editor does not clear screen when exit

Hi,

I have a Linux CentOs box and I use SecureCRT SSH2 to login to Linux and work.

In this mode, i.e., while using it from SecureCRT, the vi editor does not clear the screen when I exit it and vi buffer remains on the screen.

Can anyone tell me how to clear the screen in this situation? Is there any option in the SecureCRT that can be set to achieve this?

Also, the same vi editor clears the screen when exited while directly working on the Linux box (not by remotely login using ssh2).

Thank you for your time.

- Raveendra
Reply With Quote
  #2  
Old 07-25-2012, 10:13 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,039
Hello Reveendra,

I believe the function you're looking for is a vi setting. Here's a discussion which suggests t_ti and t_te are variables you can put in your .vimrc that would cause it to clear after exit.
Code:
set t_ti= t_te=
I think that is the best solution.

The different behavior between SecureCRT vs. when logged on at the terminal is difficult to explain, and suggests there may be other ways to accomplish your goal other than using t_ti and t_te. Perhaps the emulation is different, and vi or the remote behaves differently as a result (perhaps by way of /etc/terminfo or /etc/termcap).

When you connect at the console (directly at the Linux box where vi clears like you want), can you run the command echo $TERM and let me know what you see?

Similarly, when you connect with SecureCRT, echo $TERM.

I expect your $TERM when at the console will be Linux or Xterm. When connecting via SecureCRT your $TERM may be VT100 (whatever it's set to in Session Options / Terminal / Emulation is what you should see when you echo $TERM).
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #3  
Old 07-31-2012, 05:03 AM
raveendrajoshi raveendrajoshi is offline
Registered User
 
Join Date: Jul 2012
Posts: 4
Thanks a lot Michael for your quick response.

Sorry I could not get back to you immediately.

I tried setting 'set t_ti= t_te=' in vimrc file. But this didn't help.
Also setting this option prevented vi from clearing the screen while directly working on the Linux box (not by remotely login using ssh2).

'echo $TERM' output
directly at the Linux box (where vi clears the screen)
'echo $TERM' -> xterm

Using the SecureCRT ssh login
'echo $TERM' -> linux

Yes I have set the terminal emulation to 'Linux' in SecureCRT terminal emulation options.

After this, I changed the emulation to Xterm in SecureCRT options and tried again. Still this did not work.

BTW there is only '/etc/termcap' file present on my Linux box and no '/etc/terminfo' file.

Thank you for your time.

- Raveendra
Reply With Quote
  #4  
Old 07-31-2012, 11:10 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,039
Hi Raveendra,

If you set your SecureCRT emulation to Xterm, then disconnect and reconnect, does vim restore the original contents (remove the vim contents from screen) when you exit vim?

Vim reads your $TERM entry and reads /etc/termcap or /etc/terminfo for terminal emulation behavior rules, per vim documentation.

The te and ti termcap variables determine what vim will do when it exits (whether it will restore original pre-vim contents, or will not restore, leaving remnant vim contents.

The /etc/termcap xterm entry on your system probably contains "te=\E[?1049l:ti=\E[?1049h", which is why when your emulation is xterm on the console, vim does what you want. The termcap linux entry does not contain the same sequence. I suggested modifying your .vimrc to set t_te and t_ti so that the behavior is always what you'd like, but since then I've seen at least one post saying the Linux terminal doesn't support alternate screen buffers so I believe the best solution in this case is to rely on termcap and choose the emulation that's providing the best behavior for you on your system.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #5  
Old 08-01-2012, 02:01 AM
raveendrajoshi raveendrajoshi is offline
Registered User
 
Join Date: Jul 2012
Posts: 4
Hi Michael,

Thanks once again for your quick and prompt response.

Even when I set SecureCRT emulation to Xterm, then disconnect and reconnect, still vim does not clear its buffer contents from the screen.

Anyways I am now using PuTTY which is doing exactly what I want.

Thanks
Raveendra
Reply With Quote
  #6  
Old 08-01-2012, 09:38 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,039
When you connect with PuTTY, what do you see if you type the following command?

echo $TERM
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #7  
Old 08-01-2012, 11:27 PM
raveendrajoshi raveendrajoshi is offline
Registered User
 
Join Date: Jul 2012
Posts: 4
echo $TERM gives the following output when connected using PuTTY:

xterm
Reply With Quote
  #8  
Old 08-02-2012, 11:04 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,039
I am beginning to question whether I really understand what you're describing. Could you send window shots (to support@vandyke.com with subject attn Mike forum 10592) showing before and after vi, when using PuTTY and SecureCRT?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
Reply

Tags
clear screen , securecrt , ssh2 , vi editor , vim

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:02 PM.