Monday, September 28, 2020

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



On Tuesday, September 29, 2020 at 12:32:24 AM UTC+2, Nikolay Belikov wrote:
Hello all,

I've stumbled upon strange behavior in Vim 8.2 regarding `t_Co`
variable.  This might be a bug, but more probably is just a case of
PEBCAK, so maybe someone could point me towards what I'm doing wrong.

Background: I want to use my terminal emulator (which is plain old
`xterm`) color scheme across all TUI programs, including Vim.  I've
added `set t_Co=16` to my `.vim/vimrc` file and expected Vim to limit
itself to 16 base colors (at least this is what all sources on Internet
say to do, which I managed to find).  However, it appears that Vim does
not honor my will and resets `t_Co` to 256, unless I manually type `:set
t_Co=16` in command-line mode.

I reduced my `vimrc` to the bare minimum needed to reproduce the
problem, and now it contains a single line:

    set t_Co=16

At this point I'm unsure what to do and ask for your assistance.  I
attach a log captured by running `vim -V100vim.log` as well as version
info (`vim --version >vim.version`), and I'm willing to provide any
other info that may be of help.

Best regards,
NB

I wouldn't expect Vim to overide that setting, but maybe some script (for instance some "system vimrc" installed by your sysadmin or your software distributor) does it behind your back.

The command
        :verbose set t_Co?
should tell you both the current value and where it was set.

If that still doesn't help you, you might try to replace your "set t_Co=16" statement by

        if has('autocmd') && !has('gui_running')
                au VimEnter set t_Co=16 | syntax enable
        endif

(which would set that setting at the very end of startup, except in gvim which uses 16777216 colours no matter what you set t_Co to) and see if it changes anything.

Best regards,
Tony.
Tony.

--
--
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/6bdaaf85-1ca1-420e-8ed3-b02b8fc6498eo%40googlegroups.com.

No comments:

Post a Comment