Thursday, September 24, 2020

Re: [vim colours + iTerm2 colours]


On 24 Sep 2020, at 12:05, Lifepillar <lifepillar@lifepillar.me> wrote:

On 2020-09-23, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:
Thank you for your reply. I will check. I'm not certain about the "gui"
part of the command. I'm not using Gvim.

The termguicolors option is specifically for terminals supporting
millions of colors, such as iTerm2. It tells Vim to use the "gui" color
specifications of the color scheme you are using (as opposed to the
"cterm" color specifications). Provided that your color scheme defines
guifg and guibg colors for each highlight group (and most color schemes
do), Vim will use such colors, independent of which colors your terminal
is set to display. See `:help termguicolors`, `:help highlight-guifg`,
`:help highlight-ctermfg`.

Some terminals define an environment variable called $COLORTERM to
advertise their color capabilities. Although that is not standard or
universal, it works with iTerm2. So, if you put this snippet in your
vimrc:

  if has('termguicolors') && $COLORTERM ==# 'truecolor'
    set termguicolors
  endif

then termguicolors will be set automatically when you open Vim in
iTerm2.

Dear Life et al.,

Thank you very much for your thorough explanations! Now we are very close to the solution. My end goal is the opposite. I would like to _disable_ iTerm2 colours, when I use Vim. I would like to use _pure_ Vim colour scheme, without the interference or overlap with the iTerm2 colour profile. I think I will need to replace the "set termguicolors" with the "unset termguicolors" in your snippet to reach my goal. Thank you and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ maxim.abalenkov@gmail.com
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

No comments:

Post a Comment