tmux and screen restore

41 views
Skip to first unread message

surge

unread,
Nov 25, 2014, 11:01:58 PM11/25/14
to vim...@googlegroups.com
Hi,

If this has been answered, I'm sorry. Please point me to the right post -- I couldn't find much.

I'm using tmux through ssh and the screen is not restored upon exiting from vim. No matter what the terminal type and even with these commands in .vimrc:

if &term =~ "linux"
let &t_ti = "\<Esc>[?47h"
let &t_te = "\<Esc>[?47l"
endif

Any ideas?

Thanks!

Gary Johnson

unread,
Nov 26, 2014, 1:45:29 AM11/26/14
to vim...@googlegroups.com
Are you sure &term matches "linux"? "linux" is the value of TERM
set by a Linux console. Most terminals set TERM to "xterm". Tmux
sets TERM to "screen". (Vim sets &term to $TERM if TERM is set.)

You might try setting &t_ti and &t_te unconditionally and see if
that helps.

That said, I'm surprised that this doesn't "just work" for you. I
am currently running vim in a tmux window over ssh. The local
terminal is GNOME Terminal 2.32.0. The values of 't_te' and 't_ti'
automatically set by vim are:

t_te=^[[?1049l
t_ti=^[[?1049h

What is your remote operating system? What terminal are you running
locally? Before you override them, what does vim say the values of
'term', 't_te' and 't_ti' are?

Regards,
Gary

Sergei Gerasenko

unread,
Nov 26, 2014, 8:24:41 AM11/26/14
to vim...@googlegroups.com
Gary, thanks for your response.

Are you sure &term matches "linux"?  

Yes, I'm sure because I do an echo within that "if" block. I also force it to be "linux", so the Home and End keys work properly. But I've tried other terminal types too. tmux has "screen-256color" by default on my system.

You might try setting &t_ti and &t_te unconditionally and see if  that helps.

No, unfortunately doesn't :( 

That said, I'm surprised that this doesn't "just work" for you. 

Me too
 
am currently running vim in a tmux window over ssh.  The local terminal is GNOME Terminal 2.32.0.  The values of 't_te' and 't_ti' automatically set by vim are:
 
t_te=^[[?1049l
 
t_ti=^[[?1049h


What is your remote operating system? 

Debian Linux
 
What terminal are you running locally?

I'm connecting from under a VM running Peppermint. The terminal is set to xterm.
 
Before you override them, what does vim say the values of 'term', 't_te' and 't_ti' are?

^[[?1049l
^[[?1049h
 
Thanks again!


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/kCYZYl87zSw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sergei Gerasenko

unread,
Nov 26, 2014, 8:49:36 AM11/26/14
to vim...@googlegroups.com
I figured it out.

I noticed that it worked correctly on the remote system until I started tmux. So, I moved .tmux.conf away. Bam, the problem went away. I moved it back and started commenting out lines in .tmux.conf. I finally found the culprit that way!!

Drum roll...

alternate-screen off

As soon as I turned commented it out, it started working. There was also this:

set -g  default-terminal "screen-256color".

I commented it out as well just in case. I'll put it back if I notice a problem with "screen", which is the terminal type tmux defaults too (seems like). Though, this was not the reason.

Thanks so much!!!

Sergei

Reply all
Reply to author
Forward
0 new messages