chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

ColorToggle doesn't enable color when previously toggled in another file #23

Closed moll closed 11 years ago

moll commented 11 years ago

It looks as if :ColorToggle thinks it's on when in fact it was set on in another buffer. You can repeat it roughly this way:

And nothing happens. You'll have to toggle twice to get highlighting in the other file.

chrisbra commented 11 years ago

On Mo, 29 Jul 2013, Andri Möll wrote:

It looks as if :ColorToggle thinks it's on when in fact it was set on in another buffer. You can repeat it roughly this way:

  • Open Vim
  • Split vertically
  • :e A.css
  • :ColorToggle
  • Jump to other split
  • :e B.css
  • :ColorToggle

And nothing happens. You'll have to toggle twice to get highlighting in the other file.

Thanks. Problem is, ColorToggle worked globally, and does not consider the actual window. I think, this is fixed now.

regards,

Christian

Ein unnütz Leben ist ein früher Tod. -- Johann Wolfgang von Goethe (Iphigenie)

moll commented 11 years ago

Cool.

From the diff it looks like you switched the variables to use window local variables. I'm a bit confused — how do you envision this to work? In other issues we talked about making coloring be per-buffer (usually equivalent to per-file). Wouldn't it make more sense to store state in buffer variables?

chrisbra commented 11 years ago

Hi Andri!

On Di, 30 Jul 2013, Andri Möll wrote:

Cool.

From the diff it looks like you switched the variables to use window local variables. I'm a bit confused — how do you envision this to work? In other issues we talked about making coloring be per-buffer (usually equivalent to per-file). Wouldn't it make more sense to store state in buffer variables?

matching() is window-local, so we must use window-local variables. Otherwise, when opening a new window with the same file, the buffer local variable would be still alive, while the matching isn't active.

Liebe Grüße

Christian

Denn worin besteht die Barbarei anders als darin, daß man das Vortreffliche nicht anerkennt. -- Johann Wolfgang von Goethe (Zu J. P. Eckermann)

moll commented 11 years ago

I'm not familiar with that part of Vim, but if you're saying that Vim sets such syntax highlighting per window and not per buffer, then my god, Vim is nuts.