[vim colours + iTerm2 colours]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[vim colours + iTerm2 colours]

Maxim Abalenkov
Dear all,

How are you? Potentially, I have another very simple question for you, vim experts. My usual working environment is Vim running in an iTerm2 session. I tend to use both vim colours and iTerm2 colour scheme. If I understand correctly, the resulting colours that I see are a mixture of both Vim and iTerm2 colour profiles superimposed. Therefore, my question is how do I tell Vim to use only Vim colour settings and ignore the iTerm2 colours? Thank you very much and have a productive day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/E5FC4F59-CD38-496F-8ACC-488CCDCD694E%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Lifepillar
On 2020-09-22, Maxim Abalenkov <[hidden email]> wrote:

> Dear all,
>
> How are you? Potentially, I have another very simple question for you,
> vim experts. My usual working environment is Vim running in an iTerm2
> session. I tend to use both vim colours and iTerm2 colour scheme. If
> I understand correctly, the resulting colours that I see are a mixture
> of both Vim and iTerm2 colour profiles superimposed. Therefore, my
> question is how do I tell Vim to use only Vim colour settings and
> ignore the iTerm2 colours? Thank you very much and have a productive
> day ahead!

Does

    :set termguicolors

solve your problem?

Life.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/rkg4m0%24944%241%40ciao.gmane.io.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Maxim Abalenkov
Thank you for your reply. I will check. I'm not certain about the "gui" part of the command. I'm not using Gvim.

On Wed, Sep 23, 2020, 21:38 Lifepillar <[hidden email]> wrote:
On 2020-09-22, Maxim Abalenkov <[hidden email]> wrote:
> Dear all,
>
> How are you? Potentially, I have another very simple question for you,
> vim experts. My usual working environment is Vim running in an iTerm2
> session. I tend to use both vim colours and iTerm2 colour scheme. If
> I understand correctly, the resulting colours that I see are a mixture
> of both Vim and iTerm2 colour profiles superimposed. Therefore, my
> question is how do I tell Vim to use only Vim colour settings and
> ignore the iTerm2 colours? Thank you very much and have a productive
> day ahead!

Does

    :set termguicolors

solve your problem?

Life.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/rkg4m0%24944%241%40ciao.gmane.io.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANDEscqa_UChhQ060svJhxpRGnMcojR9WbMduik%3D08ZuiJkp2w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Grant Taylor-2
In reply to this post by Maxim Abalenkov
On 9/22/20 7:33 AM, Maxim Abalenkov wrote:
> I tend to use both vim colours and iTerm2 colour scheme. If I understand
> correctly, the resulting colours that I see are a mixture of both Vim
> and iTerm2 colour profiles superimposed. Therefore, my question is how
> do I tell Vim to use only Vim colour settings and ignore the iTerm2
> colours? Thank you very much and have a productive day ahead!

Doesn't vim just specify the color number / index (0-7 / 0-15 / 0-255)
that it wants used for specific characters and then rely on the terminal
(emulator) to set the actual colors used for any given color number / index?

I don't think there is any (good*) way for vim to know that you're using
iTerm2 and adjust it's behavior accordingly.  I think this is all in
iTerm2's control.

*Shell ~> vim may be able to deduce from the TERM environment variable
(and possibly answer back) what the terminal is.  But there usually is
not a one-to-one correlation.  Further many terminal emulators tend to
lie and say they are a different terminal; ANSI and VT100 are common.  I
don't remember what iTerm2 does by default.



--
Grant. . . .
unix || die

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/2ce2173e-e077-8905-5aa3-e0a70f83d3e4%40spamtrap.tnetconsulting.net.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Lifepillar
In reply to this post by Maxim Abalenkov
On 2020-09-23, Maxim Abalenkov <[hidden email]> 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.

Hope this helps,
Life.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/rkhnge%24120d%241%40ciao.gmane.io.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Lifepillar
In reply to this post by Grant Taylor-2
On 2020-09-23, 'Grant Taylor' via vim_use <[hidden email]> wrote:

> On 9/22/20 7:33 AM, Maxim Abalenkov wrote:
>> I tend to use both vim colours and iTerm2 colour scheme. If I understand
>> correctly, the resulting colours that I see are a mixture of both Vim
>> and iTerm2 colour profiles superimposed. Therefore, my question is how
>> do I tell Vim to use only Vim colour settings and ignore the iTerm2
>> colours? Thank you very much and have a productive day ahead!
>
> Doesn't vim just specify the color number / index (0-7 / 0-15 / 0-255)
> that it wants used for specific characters and then rely on the terminal
> (emulator) to set the actual colors used for any given color number / index?

Not when termguicolors is set to 1.

> I don't think there is any (good*) way for vim to know that you're using
> iTerm2 and adjust it's behavior accordingly.  I think this is all in
> iTerm2's control.

iTerm2 defines $TERM_PROGRAM to 'iTerm.app' and $LC_TERMINAL to
'iTerm2'.

Life.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/rkhnsp%24120d%243%40ciao.gmane.io.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Maxim Abalenkov
In reply to this post by Lifepillar

On 24 Sep 2020, at 12:05, Lifepillar <[hidden email]> wrote:

On 2020-09-23, Maxim Abalenkov <[hidden email]> 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 \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/FC6E4EC8-731F-4574-BE60-626E6CF68845%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: [vim colours + iTerm2 colours]

Lifepillar
On 2020-09-24, Maxim Abalenkov <[hidden email]> wrote:
>
> 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!

Every 0/1 option in Vim can be "unset" by prepending "no", e.g.:

    :set notermguicolors

With termguicolors disabled, however, you will *not* disable your
terminal colors; rather, the opposite.

I am guessing, because you didn't tell us which color scheme you are
using: your color scheme might be based on ANSI colors (in the range
0-15, or names as in `:help cterm-colors`), in which case the colors you
see necessarily depend on your terminal's settings.

Life.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/rkij7c%24j2u%241%40ciao.gmane.io.