EdenEast / nightfox.nvim

🦊A highly customizable theme for vim and neovim with support for lsp, treesitter and a variety of plugins.
MIT License
2.91k stars 136 forks source link

bug: `transparent = true` option doesn't work with LazyVim #360

Closed SirWrexes closed 1 year ago

SirWrexes commented 1 year ago

Neovim version (nvim -v)

NVIM v0.9.1

Operating system/version

Linux 6.3.9-arch1-1

Describe the bug

I'm migrating from Plug to LazyVim (what an upgrade, damn!) However, as title says, transparency just doesn't work. When checking hi Normal, the guibg is always set to the different themes' values. My searches in issues and PRs also haven't been fruitful.

I've tried calling setup() from many different places for this.

I've tried setting termguicolors to true from all different places too, and tried doing it before and after setting up Nightfox. And same with calling vim.cmd.colorscheme in all those different places at different times relative to LazyVim setup—in the scope of what is possible considering lazy loading. Nothing worked, I can't seem to find a way to get it right. The only workaround I found was to set the highlight groups by end, but I know from experience that it is a pain and there will always be a bit here or there that I forgot and need to fix and it can take a while to find the right group, even with helper functions included in NeoVim and TreeSitter.

Steps To Reproduce

Try setting up transparent = true with the plugin installed with LazyVim.

Expected Behavior

Welp, buffers should have transparent backgrounds.

Repro

-- DO NOT change the paths and don't remove the colorscheme
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", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "EdenEast/nightfox.nvim",
    config = function()
      require("nightfox").setup({
        transparent = true
      })
      vim.cmd.colorscheme("carbonfox")
    end,
  },
  -- add any other plugins here
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
SirWrexes commented 1 year ago

Note: Obviously, it worked absolutely fine with Plug. And my terminal is Kitty which supports transparency perfectly. So I'm at a complete loss here.

ehakan commented 1 year ago

Same issue, different repro for LazyVim, which is the recommended setup for LazyVim.

I have this under ~/.config/nvim/lua/plugins/colorschemes.lua

return {
  -- install nordfox via nightfox
  {
    "EdenEast/nightfox.nvim",
    opts = {
      transparent = true,
    },
  },

  -- configure LazyVim to load nordfox
  {
    "LazyVim/LazyVim",
    opts = {
      colorscheme = "nordfox",
    },
  },
}

"nordfox" is enabled correctly, but the transparency does not work.

ehakan commented 1 year ago

Fixed it, I was missing the second options = {}

It's supposed to be:

  {
    "EdenEast/nightfox.nvim",
    opts = {
      options = {
        transparent = true,
      },
    },
  },
SirWrexes commented 1 year ago

Yep, that fixed it! Thanks~ Goes to show that 9 out of 10 times, the problem is actually situated between the PC and the chair.