dhruvasagar / vim-zoom

Toggle zoom in / out individual windows (splits)
239 stars 15 forks source link

Background color #20

Closed cool-clay closed 2 years ago

cool-clay commented 2 years ago

How come when I zoom out back to the windows view, my background color changes from black to light grey?

My color scheme is gruvbox with the background variables set to dark.

The default is probably light grey if I remember, But I find it easier to read with black.. also nicer.

I know when I first zoom in, there is no change and when I zoom out it flashes black, then changes to grey and stays that color.

cool-clay commented 2 years ago

I found another "feature" I had opened a browser file, had netrw open and a split window, then I did a :help topic. I zoomed in on the help. Then I finished reading and did :q from the help that was zoomed in. Instead of going back to the open windows, It quit vim.

So I tried it again only this time I had the same windows and another tab open with one file. so when I quit the help from the zoom, It quit the windows and left me on the other open tab.

I didn't want to quit out, just the zoomed window.

dhruvasagar commented 2 years ago

@cool-clay Regarding the color, it must have something to do with the colorscheme, maybe the background vim setting. As far as quiting the help window, that's just vim again, when you quit the last window it quits vim.

cool-clay commented 2 years ago

I found another version, maybe the original version and it does not hve the color issue. So I'm thinking that it is not my .vimrc.

And the quitting thing. There were other windows, and files open. Even with changes, and it still did it, Also, while zoomed in, if I hit ctrl WW to switch windows, that terminated them.

The other version that I found has the same issues.

The other version doesn't look maintained anymore. But it works better on the background color so I'm using it. And the other, I guess I need to be careful.

Anyway, I do like the plugin. And I appreciate you caring on the project.

Maybe try out the windows thing..and see for yourself.

dhruvasagar commented 2 years ago

Will test more and let you know, thanks.

dtrckd commented 2 years ago

Hi there,

I have the same issue.

Note that the issue exists only if I use a colorschme. In my case dracula from dracula/vim.

If I remove the colorscheme, then the background is not altered when Unzooming.

dhruvasagar commented 2 years ago

@cool-clay are you also using dracula ? i'll try to reproduce this.

dtrckd commented 2 years ago

Hi,

I've had a look, and in fact, I set the the background color in my vimrc after the call to the colorscheme, like this

colo dracula
hi Normal ctermbg=233

And the point is that, when unzooming, the backgound color come back to the value of the colorscheme, not the one I defined manually after... (and other highlight command still defined after the colorscheme are also reset when unzooming.)

dhruvasagar commented 2 years ago

@dtrckd That's something the session handling can't handle I believe. Putting this in your vimrc may do the trick :

augroup Prosession
  au!

  autocmd User ProsessionPost hi Normal ctermbg=233
augroup END
dtrckd commented 2 years ago

I Just tried, it doesn't work.

dhruvasagar commented 2 years ago

@dtrckd sorry for the brain fart, that wasn't right. I have just pushed and added a new user autocmd for zoom. namely ZoomPre and ZoomPost.

augroup Zoom
  au!

  autocmd User ZoomPost hi Normal ctermbg=233
augroup END

This may work, can you give it a shot ?

dtrckd commented 2 years ago

Ok, it brings back the settings like this. Thank you @dhruvasagar :).

Any idea how we could maybe update/change the colorcheme in order to make "sessionoptions" include all user hi options ? I have for example a dozens of hi options that overwrites the colorscheme, so they need to be copied twice in the vimrc which is maybe not the most elegant way of doing it?

dhruvasagar commented 2 years ago

@dtrckd I gave a quick look to sessionoptions before adding these autocmds, but it doesn't look like there's a way to do this. these highlight / syntax definitions aren't persisted.

As far as overriding the colorscheme, my advice would be to fork the original colorscheme and add the changes to it instead of doing these in your vimrc.

dhruvasagar commented 2 years ago

@dtrckd also, you could place all your customizations in a separate vim file and :source it both in vimrc and in the autocmd above