On 2021-02-18, Haodong DU wrote:
> Describe the bug
> In a terminal with dark background, when you set TERM=screen-256color or
> really
> run tmux which requires TERM set to screen-256color, the background is always
> detected as light. Then default.vim instead of ron.vim is used. default.vim is
> hard to read in dark background.
>
> To Reproduce
> Two way to test, really use tmux or make vim think you are using tmux by
> setting TERM
>
> 1. Open tmux in a terminal with dark background. In tmux conf set TERM to
> screen-256color.
> 2. Open vim, and query set background? and colorscheme.
>
> OR
>
> 1. Open a terminal with dark background.
> 2. export TERM=screen-256color
> 3. Open vim, and query set background? and colorscheme.
>
> With terminal.app and alacritty.app background is detected as light in both
> cases. With iTerm2, background is detected correctly in the second case, but
> still worn't work when you really use tmux. This is a bit involving, terminal/
> tmux/vim all could have problems. But currently Vim seems most at fault.
>
> Expected behavior
> background dectected as dark and ron.vim color scheme is used(it will still
> displays as default, i know).
>
> Screenshots
> If applicable, copy/paste the text or add screenshots to help explain your
> problem.
>
> Environment (please complete the following information):
>
> • Vim version: 8.2.1972
> • OS: macos 11.2.1
> • Terminal: Macos Terminal and Alacritty and iTerm2
I see the same behavior in Linux. It appears, though, that Vim is
not detecting a background color from tmux and hence defaults to
'light', as it says in ":help 'background'".
Vim tries to determine the background color from the terminal using
the t_RB option, but if TERM is "screen-256color", that option is
not set. You can verify this by executing any of the following.
:set termcap
:set t_RB?
:echo v:termrbgresp
That last is actually the response Vim received from the t_RB query.
Vim does try to guess the background from the terminal name, but
"screen-256color" is not one of the names it checks.
Your best bet may be to follow the suggestion in ":help
'background'" and put this in your vimrc:
:if &term == "screen-256color"
: set background=dark
:endif
Regards,
Gary
--
--
You received this message from the "vim_dev" 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 the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20210219014350.GA10301%40phoenix.