On Fri, Feb 19, 2021 at 5:36 AM Haodong Du <[email protected]> wrote:

> Thank you Gary. Your explanation is very clear. Indeed with TERM=screen*
> the query returns nothing.
> But I'm still a little confused as it seems Vim can detect background from
> screen with the same TERM as tmux. But not always, in some terminal apps,
> it works with screen. Is that the 'guessing'? Sounds like magic.
>
> Regards,
> Haodong
>

>From a certain point of view, it _is_ a kind of magic.

Some terminals define a certain key sequence allowing the application
running in them to query (among others) the background color, or at least
to determine if it is light or dark. Others don't. It depends not only on
the $TERM value but also on the termcap/terminfo for that terminal: at
startup, Vim will send a certain number of queries to the terminal and
store the answers when (and if) they arrive (asynchronously), see the
various entries under ":help term*resp" (without the quotes, and with <Tab>
or CTRL-D at the end). The one about the background is v:termbgresp, which
the terminal sends in answer to a t_RB key sequence sent by Vim.


Best regards,
Tony.

-- 
-- 
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/CAJkCKXtEBoeCpz5ReiLHeHGUUR_37EyVSdVo%2BXjdoFyBC%3D-Jvw%40mail.gmail.com.

Raspunde prin e-mail lui