Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I have a SSH session in GNU Screen to another machine on which I'm also using GNU Screen, 256 colors don't seem to work. The $TERM is still set correctly. However, if I run Vim, the theme does not look correct as it would with only one screen session.

Local machine: 256 colors in VIM okay
    Screen session: 256 colors in VIM okay
        SSH to remote machine: 256 colors in VIM okay
            Screen session on remote machine: 256 colors in VIM _not_ okay
share|improve this question
1  
What is $TERM set to? Is the remote system running the same OS as the local system? Maybe the termcap entry on the remote system is incorrect. –  larsks Jul 6 '11 at 17:50
1  
A couple of quick stabs on this: What's in your .vimrc? / Is screen invoking the same shell/rc? What actually is your $TERM? (I'm assuming xterm-256color) Also, are you getting any colours at all, or are they just the wrong ones? –  SmallClanger Jul 6 '11 at 17:51
    
Getting colours, just the wrong ones. Both systems are running Debian. –  psp Jul 6 '11 at 18:05
    
Starting inner gnu screen with: TERM=screen-256color screen solved this issue. –  dartilla Jul 26 '12 at 17:27
add comment

2 Answers

up vote 2 down vote accepted

This is probably a bug in screen. It has some known funkiness with recursive sessions. Unfortunately the project is pretty stagnant (last version released 3 years ago) and bug fixes and features aren't getting added.

Try tmux instead. It does basically the same thing but has a lot of the problematic bits from screen smoothed out and is actively maintained and developed.

share|improve this answer
    
+1 for that. I don't use screen much, but I figured it hadn't been updated much because it already just worked. It's so hard to tell, sometimes. :) –  SmallClanger Jul 6 '11 at 18:13
    
I still use screen on a regular bases as a long time user, but it's definetly mothballing. It works but it's also broken. I find more and more things I have to switch to tmux for and always recommend anybody just learning switch now rather than later when they have problems! Scripting and configuration for tmux is also much more pleasant. –  Caleb Jul 6 '11 at 18:25
add comment

Tmux is indeed the way to go. By the way, I usually solve the color issues in screen/tmux by using aliases:

alias tmux='tmux -2 -u'
alias vim='env TERM=xterm-256color vim'

This way the applications will always display correct colors, if it's not the case then it's a bug and you should check it out with the developers. IIRC the #tmux chan on FreeNode is full of developers and experienced users.

share|improve this answer
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.