Question about the use of "g:term_ansi_colors"

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about the use of "g:term_ansi_colors"

Masaaki Nakamura
Hi all,

Thanks to the patch 8.0.1685, the output in terminal buffers got easy to see in any colorscheme. I'm really happy with it.

Now, I would like to set "g:term_ansi_colors" in my colorscheme file, but then I'm wondering it could be harmful for other colorschemes. For example, first I set my colorscheme A and then change to another colorscheme B, the "g:term_ansi_colors" set by A may not match with B.

At first, I can use "ColorScheme" autocmd event to restore the default colors. However, it is triggered after the colorscheme B sorced. If B also wants to set its "g:term_ansi_colors", it might be overwritten unintentionally.

Anyone has ideas to restore the default colors? Or it is not expected to be set in a colorscheme file?

--
--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the use of "g:term_ansi_colors"

Bram Moolenaar

Masaaki Nakamura wrote

> Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> to see in any colorscheme. I'm really happy with it.
>
> Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> but then I'm wondering it could be harmful for other colorschemes. For
> example, first I set my colorscheme A and then change to another
> colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
>
> At first, I can use "ColorScheme" autocmd event to restore the default
> colors. However, it is triggered after the colorscheme B sorced. If B
> also wants to set its "g:term_ansi_colors", it might be overwritten
> unintentionally.
>
> Anyone has ideas to restore the default colors? Or it is not expected
> to be set in a colorscheme file?

I don't think there is an easy way.  I can add the ColorSchemePre
autocommand event.

--
CONCORDE: Message for you, sir.
   He falls forward revealing the arrow with the note.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the use of "g:term_ansi_colors"

Christian Brabandt

On Mo, 30 Apr 2018, Bram Moolenaar wrote:

>
> Masaaki Nakamura wrote
>
> > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > to see in any colorscheme. I'm really happy with it.
> >
> > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > but then I'm wondering it could be harmful for other colorschemes. For
> > example, first I set my colorscheme A and then change to another
> > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> >
> > At first, I can use "ColorScheme" autocmd event to restore the default
> > colors. However, it is triggered after the colorscheme B sorced. If B
> > also wants to set its "g:term_ansi_colors", it might be overwritten
> > unintentionally.
> >
> > Anyone has ideas to restore the default colors? Or it is not expected
> > to be set in a colorscheme file?
>
> I don't think there is an easy way.  I can add the ColorSchemePre
> autocommand event.

Shouldn't syncolor and nosyntax reset g:term_ansi_colors?

diff --git a/runtime/syntax/nosyntax.vim b/runtime/syntax/nosyntax.vim
index 0ab341237..ace75b5fb 100644
--- a/runtime/syntax/nosyntax.vim
+++ b/runtime/syntax/nosyntax.vim
@@ -28,3 +28,4 @@ endif
 if exists("syntax_manual")
   unlet syntax_manual
 endif
+unlet! g:term_ansi_colors
diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim
index 8d0064db1..ed0ede4c1 100644
--- a/runtime/syntax/syncolor.vim
+++ b/runtime/syntax/syncolor.vim
@@ -83,3 +83,4 @@ SynLink Debug         Special

 delcommand SynColor
 delcommand SynLink
+unlet! g:term_ansi_colors


Best,
Christian
--
Herz, mein Herz, sei nicht beklommen und ertrage dein Geschick! Neuer
Frühling gibt zurück, was der Winter dir genommen.
                -- Heinrich Heine

--
--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the use of "g:term_ansi_colors"

Masaaki Nakamura
2018年4月30日月曜日 21時55分39秒 UTC+8 Christian Brabandt:

> On Mo, 30 Apr 2018, Bram Moolenaar wrote:
>
> >
> > Masaaki Nakamura wrote
> >
> > > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > > to see in any colorscheme. I'm really happy with it.
> > >
> > > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > > but then I'm wondering it could be harmful for other colorschemes. For
> > > example, first I set my colorscheme A and then change to another
> > > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> > >
> > > At first, I can use "ColorScheme" autocmd event to restore the default
> > > colors. However, it is triggered after the colorscheme B sorced. If B
> > > also wants to set its "g:term_ansi_colors", it might be overwritten
> > > unintentionally.
> > >
> > > Anyone has ideas to restore the default colors? Or it is not expected
> > > to be set in a colorscheme file?
> >
> > I don't think there is an easy way.  I can add the ColorSchemePre
> > autocommand event.
>
> Shouldn't syncolor and nosyntax reset g:term_ansi_colors?
>
> diff --git a/runtime/syntax/nosyntax.vim b/runtime/syntax/nosyntax.vim
> index 0ab341237..ace75b5fb 100644
> --- a/runtime/syntax/nosyntax.vim
> +++ b/runtime/syntax/nosyntax.vim
> @@ -28,3 +28,4 @@ endif
>  if exists("syntax_manual")
>    unlet syntax_manual
>  endif
> +unlet! g:term_ansi_colors
> diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim
> index 8d0064db1..ed0ede4c1 100644
> --- a/runtime/syntax/syncolor.vim
> +++ b/runtime/syntax/syncolor.vim
> @@ -83,3 +83,4 @@ SynLink Debug         Special
>
>  delcommand SynColor
>  delcommand SynLink
> +unlet! g:term_ansi_colors
>
>
> Best,
> Christian
> --
> Herz, mein Herz, sei nicht beklommen und ertrage dein Geschick! Neuer
> Frühling gibt zurück, was der Winter dir genommen.
> -- Heinrich Heine
Although "ColorSchemePre" event looks useful, I think reasonable to reset it by syntax/nosyntax.vim, just like highlight groups. I like the idea.

--
--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the use of "g:term_ansi_colors"

Bram Moolenaar
In reply to this post by Christian Brabandt

Christian wrote:

> On Mo, 30 Apr 2018, Bram Moolenaar wrote:
>
> > Masaaki Nakamura wrote
> >
> > > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > > to see in any colorscheme. I'm really happy with it.
> > >
> > > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > > but then I'm wondering it could be harmful for other colorschemes. For
> > > example, first I set my colorscheme A and then change to another
> > > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> > >
> > > At first, I can use "ColorScheme" autocmd event to restore the default
> > > colors. However, it is triggered after the colorscheme B sorced. If B
> > > also wants to set its "g:term_ansi_colors", it might be overwritten
> > > unintentionally.
> > >
> > > Anyone has ideas to restore the default colors? Or it is not expected
> > > to be set in a colorscheme file?
> >
> > I don't think there is an easy way.  I can add the ColorSchemePre
> > autocommand event.
>
> Shouldn't syncolor and nosyntax reset g:term_ansi_colors?

g:term_ansi_colors is about the colors, not the syntax.  Thus it's
related to highlighting.

syncolor.vim is a bit of a corner case, since it can set and reset the
colors used for syntax highlighting.  But I don't see how this matters
for the colors to be used in a terminal (which may have nothing to do
with syntax highlighting).


--
Luxury. We used to have to get out of the lake at three o'clock in the
morning, clean the lake, eat a handful of hot gravel, go to work at the
mill every day for tuppence a month, come home, and Dad would beat us
around the head and neck with a broken bottle, if we were LUCKY!

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the use of "g:term_ansi_colors"

Masaaki Nakamura
2018年4月30日月曜日 23時21分36秒 UTC+8 Bram Moolenaar:

> Christian wrote:
>
> > On Mo, 30 Apr 2018, Bram Moolenaar wrote:
> >
> > > Masaaki Nakamura wrote
> > >
> > > > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > > > to see in any colorscheme. I'm really happy with it.
> > > >
> > > > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > > > but then I'm wondering it could be harmful for other colorschemes. For
> > > > example, first I set my colorscheme A and then change to another
> > > > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> > > >
> > > > At first, I can use "ColorScheme" autocmd event to restore the default
> > > > colors. However, it is triggered after the colorscheme B sorced. If B
> > > > also wants to set its "g:term_ansi_colors", it might be overwritten
> > > > unintentionally.
> > > >
> > > > Anyone has ideas to restore the default colors? Or it is not expected
> > > > to be set in a colorscheme file?
> > >
> > > I don't think there is an easy way.  I can add the ColorSchemePre
> > > autocommand event.
> >
> > Shouldn't syncolor and nosyntax reset g:term_ansi_colors?
>
> g:term_ansi_colors is about the colors, not the syntax.  Thus it's
> related to highlighting.
>
> syncolor.vim is a bit of a corner case, since it can set and reset the
> colors used for syntax highlighting.  But I don't see how this matters
> for the colors to be used in a terminal (which may have nothing to do
> with syntax highlighting).
>

I see. Since we executes ":syntax reset" at the top of a colorscheme file, I thought good idea, but, indeed, it is not syntax.

I built the latest vim and ColorSchemePre works as I want. Thanks you.

--
--
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].
For more options, visit https://groups.google.com/d/optout.