Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have set up my tmux to use screen-256colors and it works great with vim.

However, when I ssh to a remote host from within tmux, screen-256colors isn't recognized, so I'm getting errors like this:

E558: Terminal entry not found in terminfo 'screen-256color' not known. Available builtin terminals are:
    builtin_ansi
    builtin_xterm
    builtin_iris-ansi
    builtin_dumb defaulting to 'ansi'

Other than editing each remote .bashrc (similarly to this suggestion), is there any way to set the TERM correctly and automatically on the remote host?

share|improve this question
add comment

2 Answers

up vote 20 down vote accepted

You can copy the necessary terminfo descriptions to remote hosts.

  1. On the local system, dump the description to text format:

    infocmp xterm-256color > xterm-256color.ti
    infocmp screen-256color > screen-256color.ti
    
  2. Copy to the remote host and compile:

    tic xterm-256color.ti
    tic screen-256color.ti
    

The descriptions will be stored in ~/.terminfo.

(infocmp and tic are part of the ncurses or ncurses-bin packages in most Linux distributions, as well as most BSDs that use ncurses.)

share|improve this answer
    
Thanks for the quick and neat answer! I wish I could +2 this one –  Yoav Aner Jun 2 '12 at 21:38
    
Agree. Worked like charm ! –  YordanGeorgiev Mar 11 at 10:09
add comment

I have this in my .bashrc:

aliash ssh='TERM=screen ssh'
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.