Wednesday, September 30, 2020

Re: `set t_Co=16` in vimrc file has no effect

On 2020-09-30, Christian Brabandt wrote:
> On Di, 29 Sep 2020, Gary Johnson wrote:
>
> > I'm too busy at the moment to give this a very thoughtful response,
> > and it was a while ago that I looked at that code, but it seems that
> > there were several things done in response to receiving the
> > termresponse, so I don't know that one option would serve all needs.
> > In the present case, the only problem seems to be the setting of
> > t_Co.
> >
> > The problem I've had is that I want to set various options and
> > highlights depending on the terminal type, but the type is not
> > accurately known when vimrc is read, and when the TermResponse event
> > is triggered, not everything can be set correctly.
> >
> > I've resorted to having the termresponse queried in my ~/.bashrc,
> > which sets an environment variable that vimrc can then read. It
> > works very well for making terminal-dependent settings in my vimrc
> > and colorscheme files. When vim queries and receives the
> > termresponse itself, it then makes the additional settings you
> > mentioned. It would be nice, though, if this could all be done
> > within Vim.
> >
> > I think maybe the whole termresponse behavior should be thought
> > through and made more useful, perhaps by adding a later
> > TermResponse-like event. I'll try to find some time.
>
> I think this was suggested before. Also the todo file contains a couple
> of statements regarding termresponse, e.g.
>
> ,----
> | Add another autocommand like TermResponse that is fired for the other terminal
> | responses, such as bg and fg. Use "bg", "fg", "blink", etc. for the name.
> `----
>
> I think Bram also suggested to add additional TermResponse<Event> for
> the various term events before.
>
> BTW: Why wouldn't the VimEnter autocommand work? Is that, because
> changing terminal options would then require some more initialization or
> is that triggered too early?

Thanks for the pointers.

I had been thinking of having a single TermResponsePost event, but
having multiple events might be better, especially if each of the
other responses is sent separately.

As I recall, VimEnter is too early.

I often work remotely, with a terminal on my desktop at home or in
an office and the host on which Vim is running many miles away,
often through a relatively slow network. For a while, after either
my xterm changed or Vim changed so that t_Co was reset after
receiving the termresponse, my vim screen would flash at startup
because it would first be drawn using t_Co=16 as set in my vimrc,
then be redrawn a moment later at t_Co=256 when the termresponse was
received.

I am currently working from home and all my Vim sessions are local
or within my home network, so I don't have the delay problem. I'll
have to determine which of the VimEnter and TermResponse events
occurs first, but a general solution should assume that TermResponse
occurs later.

Regards,
Gary

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200930172356.GC31849%40phoenix.

No comments: