13

I am having trouble with my colorscheme in vim. When editing a file using a vim session started in GNU screen, the text background is not rendered correctly. In a session outside screen, the entire background is gray (how it should be). For a vim window inside screen, only the background directly behind the text appears gray. The rest is black.

I have TERM set to xterm-256color in both my .cshrc and .screenrc. My .vimrc has set t_Co=256

I am using csh.

Edit: I am connecting through cygwin.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Ravi
  • 133
  • 1
  • 4
  • 1st of all, you are not working on tty, are u? then you could try if `term screen-256color` in your screenrc works – Kent Feb 04 '13 at 15:41
  • I did try that as well - no luck. – Ravi Feb 04 '13 at 15:49
  • setenv TERM xterm-256color – Satish Feb 04 '13 at 16:32
  • To enable colors on XTerm you will need to run the configure scripts with the --enable-256-color switch – Satish Feb 04 '13 at 16:33
  • My xterm is working perfectly - but screen is displaying background color in vim slightly wrong. I already have `setenv TERM xterm-256color` – Ravi Feb 04 '13 at 17:23
  • 3
    I found the issue, I needed to have this set: defbce "on" This forces background colours to refresh. "Change background-color-erase setting. If bce is set to “on”, all characters cleared by an erase/insert/scroll/clear operation will be displayed in the current background color. Otherwise the default background color is used." – Ravi Feb 04 '13 at 18:27
  • 2
    Ravi, please write that as an answer; it's difficult to find otherwise. – Ingo Karkat Feb 05 '13 at 13:56
  • I intended to come back and fill it in today - I was unable to post answers yesterday since my account was new. – Ravi Feb 05 '13 at 16:31

3 Answers3

11

[filling in for the OP, see the comment]

The OP found the issue:

I needed to have this set:

defbce "on"

This forces background colours to refresh.

"Change background-color-erase setting. If bce is set to “on”, all characters cleared by an erase/insert/scroll/clear operation will be displayed in the current background color. Otherwise the default background color is used."

– Ravi 19 hours ago

sehe
  • 374,641
  • 47
  • 450
  • 633
9

As explained here, disable Background Color Erase (BCE) by clearing the t_ut terminal option (run :set t_ut= in Vim and then press Control+L to refresh the terminal's display) so that color schemes work properly when Vim is used inside tmux and GNU screen.

sunaku
  • 2,156
  • 19
  • 10
5

To make vim, bash, and screen settings work together:

1) In .bashrc add the following:

export TERM=xterm-256color

2) In .screenrc add the following:

altscreen on
defbce on
set term=screen-256color
bloodrootfc
  • 1,133
  • 12
  • 10