CosmicNvim / CosmicNvim

CosmicNvim is a lightweight and opinionated Neovim config for web development, specifically designed to provide a 💫 COSMIC programming experience!

Home Page:https://cosmicnvim.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Onedark Theme Style Keeps Resetting on Exit

LSleutsky opened this issue · comments

So I'm using the navarasu/onedark.nvim theme for this setup. I set the theme value to nil in the cosmic/config/config.lua file:

  ...

  -- 'nord',
  -- 'onedark',
  -- 'rose-pine',
  theme = nil, -- don't define or set to nil, if you want to enable your own theme in cosmic/config/plugins.lua

Then I am just using the theme in the local plugins variable in the cosmic/config/lua file:

local plugins = {
  add = {
    ...

   'navarasu/onedark.vim'
  }
}

Then, in the cosmic/theme/init.lua file is where I have my onedark config like so:

require('onedark')setup {
  style = 'deep'

  ...
}

But every time I exit nvim, it somehow goes back to the default style of using onedark with CosmicNvim on initial install. I have to run CosmicReload every time to get the deep style back. Anyone know why that is? Kind of annoying...

Thanks!

Potential solution:
in config.lua, just do

local config = {}
config.theme = 'onedark'
return config

Don't add anything to init.lua. At all.
in plugins.lua add the line as indicated

  use({
    'navarasu/onedark.nvim',
    as = 'onedark',
    config = function()
 -->     vim.g.onedark_style = 'deep' <--
      vim.cmd('color onedark')
    end,
    disable = config.theme ~= 'onedark',
  })

You'll get a warning that this format has been depricated and a completely unhelpful prompt to check the readme, but it works and is persistent.

@undeadbydawn -- Perfect! Works like a charm, thanks so much! Will close this issue...

@undeadbydawn -- Perfect! Works like a charm, thanks so much! Will close this issue...

Important note if you update with git pull, it may object to changes in plugins.lua and give you an overwrite warning.
To get around this, do

git add *
git stash
git pull

then run :PackerSync as usual to check everything still works