nvim-noirbuddy icon indicating copy to clipboard operation
nvim-noirbuddy copied to clipboard

Improve support for colorscheme switching

Open ernstwi opened this issue 11 months ago • 2 comments

This PR separates initialisation of the colorscheme from actually enabling the colorscheme.

setup now only stores the configuration, and a separate call to load is required to activate the colorscheme. This seems to be how larger colorschemes do it – I looked at folke/tokyonight.nvim and marko-cerovac/material.nvim.

The benefit is that it enables the user to switch back and forth using :colorscheme without losing their settings. I believe this should solve the confusion in #12 .

load also takes opts, which will extend those used for setup. So if I wanted to have several noirbuddy configs to switch between I could create files in the colors dir of my neovim config root like this:

// colors/noirbuddy-alt
require("noirbuddy").load({
  colors = {
    ...
  }
})

Which I can then activate using: :colorscheme noirbuddy-alt.

What do you think?

ernstwi avatar Jan 02 '25 15:01 ernstwi

Hey thanks for PR! This is definitely something I've wanted to revisit.

We kinda already did this initially, but my Linux-using co-author @n1ghtmare was having weird results with it, so we opted for the setup() method approach.

I'm definitely not opposed! Just need to take the time to review, and make sure it works for everyone / doesn't break anything for anyone ❤️

jesseleite avatar Jan 02 '25 23:01 jesseleite

Sure, no rush! It should be noted also that this is a breaking change, since it will require users to add :colorscheme noirbuddy.

ernstwi avatar Jan 03 '25 11:01 ernstwi