olimorris / onedarkpro.nvim

🎨 Atom's iconic One Dark theme. Cacheable, fully customisable, Tree-sitter and LSP semantic token support. Comes with variants
MIT License
818 stars 46 forks source link

[Bug]: Error when setting `Comment` highlights (for the first time)? #217

Closed chmanie closed 1 year ago

chmanie commented 1 year ago

Your minimal.lua config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "olimorris/onedarkpro.nvim",
    opts = {
      -- Your OneDarkPro config goes here
    },
    config = true
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

require("onedarkpro").setup({
    highlights = {
        Comment = { italic = true },
    },
})

vim.cmd("colorscheme onedark")

Error messages

Error detected while processing /home/USER/minimal.lua:
E5113: Error while calling lua chunk: ...ages/start/onedarkpro.nvim/lua/onedarkpro/utils/init.lua:81: bad argument #1 to 'pairs' (table expected, got boolean)
stack traceback:
        [C]: in function 'pairs'
        ...ages/start/onedarkpro.nvim/lua/onedarkpro/utils/init.lua:81: in function 'replace_vars'
        ...ages/start/onedarkpro.nvim/lua/onedarkpro/utils/init.lua:82: in function 'replace_vars'
        ...ages/start/onedarkpro.nvim/lua/onedarkpro/utils/init.lua:82: in function 'replace_vars'
        ...kages/start/onedarkpro.nvim/lua/onedarkpro/highlight.lua:20: in function 'groups'
        ...ges/start/onedarkpro.nvim/lua/onedarkpro/lib/compile.lua:70: in function 'compile'
        ...imPackages/start/onedarkpro.nvim/lua/onedarkpro/init.lua:16: in function 'cache'
        ...imPackages/start/onedarkpro.nvim/lua/onedarkpro/init.lua:55: in function 'validate_cache'
        ...imPackages/start/onedarkpro.nvim/lua/onedarkpro/init.lua:69: in function 'setup'
        /home/USER/minimal.lua:38: in main chunk

Describe the bug

The above error message shows when starting up or when running :OnedarkCache. Please note that I'm in Nix and am using the latest vimPlugin version of this theme. I could reproduce it using the minimal config, but after a few times opening and closing the error was gone (it does seem to be a caching issue). When using my default vim config, this error shows every time neovim is opened.

Sadly I could not reproduce it in a non-nix system.

Reproduce the bug

Be on nixOS with Neovim installed and run the above command to use the given minimal config.

Final checks

olimorris commented 1 year ago

As you can probably guess, I don't use Nix and so can't reproduce. You can set caching = false in the config which might help?

Would this have anything to do with permissions within Nix?

olimorris commented 1 year ago

MrJones uses the theme as well as Nix. Could be worth checking out his config: https://github.com/mrjones2014/dotfiles/blob/7c9dabb2428964ee21330d1ae16fca5594f65318/nvim/lua/my/configure/theme.lua#L2

chmanie commented 1 year ago

Ah yeah, but Mrjones is using lazy instead of the nix vim plugins. I'll take a look at the issue when I have time and will report back. Maybe I can even fix it somehow :)

mrjones2014 commented 1 year ago

FWIW @chmanie I love Nix but IMHO it's not worth the headache of trying to use Nix to manage Neovim plugins. I just link my Lua config via Nix.

I find that you lose a lot of functionality and run into a lot of weird edge cases when trying to install and configure Neovim plugins via Nix.

See my neovim.nix setup file. It pretty much just installs external dependencies and then links my Lua config.

mrjones2014 commented 1 year ago

Also based on the error message, that error should not be possible on latest plugin version, given this line of code.

I'm not entirely sure how the nixpkgs versions of Neovim plugins are packaged but it seems you aren't on latest plugin version (another reason I choose not to use Nix to manage them 😛)

chmanie commented 1 year ago

Yeah, you're right. Let's close this. I might be switching over to Lazy at some point anyways.