Vim Colors – End of Lines Not Coloring in GNU Screen

colorsgnu-screenvim

When vim is started inside of gnu screen it does not colour the background after text.

White background

Screen looks like it should be setup for handling 256 colours correctly:

$ screen
$ tput colors
256
$ echo $term
xterm-256colors

OS & Shell I am using:

$ cat /etc/redhat-release 
Red Hat Enterprise Linux WS release 4 (Nahant Update 9)
$echo $shell
/bin/tcsh

The Colour test looks like it is working ok except the end of lines:

:runtime syntax/colortest.vim
:source %

vim colour test inside screen

And when not using screen:

vim colour test

Is there any other settings I should be checking, is there a screen mode I can force to allow the colours to be redrawn correctly?

Best Answer

Partly based on: tmux-and-screen-256-term-not-supported.

The issue resolves itself when using a 'screen' term. To identify as 256 colors correctly it should be 'screen-256colors'. Which leads to the error below :

E558: Terminal entry not found in terminfo
'screen-256colors' not known. Available builtin terminals are:
    builtin_gui
    builtin_ansi
    builtin_xterm
    builtin_iris-ansi
    builtin_d

To create a screen-256colors entry:

infocmp screen > screen-256color.ti

Changing (screen-256color.ti)

#       Reconstructed via infocmp from file: /usr/share/terminfo/s/screen
screen|VT 100/ANSI X3.64 virtual terminal, 
        am, km, mir, msgr, xenl, 
        colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,

to :

#       Reconstructed via infocmp from file: /usr/share/terminfo/s/screen
screen-256color|VT 100/ANSI X3.64 virtual terminal, 
        am, km, mir, msgr, xenl, 
        colors#256, cols#80, it#8, lines#24, ncv#3, pairs#64,

Now create the terminfo :

tic screen-256color.ti
Related Question