xiyaowong / transparent.nvim

Remove all background colors to make nvim transparent
806 stars 23 forks source link

Plugin breaks colorscheme and prints a stack trace #31

Closed RaphGL closed 1 year ago

RaphGL commented 1 year ago

Hey, love the plugin been using it for a while now. It's been working fine but yesterday after an update it broke. The colorscheme no longer works on lualine but is working for syntax highlighting and the background colors, I get the following stack trace when opening neovim:

Error detected while processing ColorScheme Autocommands for "*":
Error executing vim.schedule lua callback: ...k/packer/start/nvim-transparent/lua/transparent/init.lua:69: ColorScheme Autocommands for "*": Vim(append):E5248: Invalid character in group name
stack traceback:
        [C]: in function 'colorscheme'
        ...k/packer/start/nvim-transparent/lua/transparent/init.lua:69: in function 'toggle'
        ...k/packer/start/nvim-transparent/lua/transparent/init.lua:99: in function ''
        vim/_editor.lua: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

I tried fixing it myself but couldn't, when I remove the line transparent/init.lua:69 the issue seems to be fixed but the following message remains

Error detected while processing /home/raph/.dotfiles/Configs/nvim/.config/nvim/init.lua:
E5248: Invalid character in group name

For reference my init.lua looks like this:

require "user.impatient"
require "user.options"
require "user.keymaps"
require "user.plugins"
require "user.autocommands"
require "user.colorscheme"
require "user.cmp"
require "user.telescope"
require "user.gitsigns"
require "user.treesitter"
require "user.autopairs"
require "user.comment"
require "user.nvim-tree"
require "user.bufferline"
require "user.lualine"
require "user.toggleterm"
require "user.illuminate"
require "user.indentline"
require "user.lsp"
require "user.dap"

So nothing is wrong on my end I think

saumitrapatil commented 1 year ago

I'm facing the same issue. I found a temporary workaround though, comment out require "user.bufferline". (no errors for me)

xiyaowong commented 1 year ago

Please try the latest commit.

saumitrapatil commented 1 year ago

Please try the latest commit.

I am note getting the stack trace message anymore but

Error detected while processing /home/saumitra/.dotfiles/nvim/.config/nvim/init.lua:
E5248: Invalid character in group name
E5248: Invalid character in group name
E5248: Invalid character in group name

is still being prompted on startup.

RaphGL commented 1 year ago

Same here, the stack trace is gone, the error I get is this:

Error detected while processing /home/raph/.config/nvim/init.lua:
E5248: Invalid character in group name
xiyaowong commented 1 year ago

I need a minimum configuration to reproduce this issue.

RaphGL commented 1 year ago

I need a minimum configuration to reproduce this issue.

You can try my neovim config if you want https://github.com/RaphGL/Dotfiles/tree/master/Configs/nvim/.config/nvim

I'm using packer for managing plugins

ansidev commented 1 year ago

@RaphGL

IMO, the plugin author is requesting a minimal nvim config for detecting the root cause easily.

You just provide your whole nvim config, and it's not what he expects.

nvim released version 0.9 which you can run nvim with custom config folder, please use it to create a minimal nvim config (keyword is NVIM_APPNAME).

RaphGL commented 1 year ago

I went back to hunting down what the issue was as it was bothering me. After around 30 minutes I think I've solved the issue.

So it seems that bufferline.nvim was causing the issue (I know this is true because removing bufferline altogether fixes the issue). The error is fixed by changing from:

bufferline.setup {
  highlights = {
    fill = {
      fg = { attribute = "fg", highlight = "#ff0000" },
      bg = { attribute = "bg", highlight = "TabLine" },
    }
}

to:

bufferline.setup {
  highlights = {
    fill = {
      fg = { attribute = "fg", highlight = "TabLine" },
      bg = { attribute = "bg", highlight = "TabLine" },
    }
}

Let me know if this fixes it for you as well @saumitrapatil @xiyaowong @ansidev

ansidev commented 1 year ago

You assigned an invalid value for highlight. Value of highlight is a highlight group.

If you want to assign color, the syntax is

fg = "#ff0000"

You should read the documentation carefully.

FYI: https://github.com/akinsho/bufferline.nvim/blob/main/doc/bufferline.txt#L762

ansidev commented 1 year ago

@RaphGL I guess the root cause was detected. This issue can be closed.

P/s: Relate to bufferline, if you are using a colorscheme plugin, you can check their documentation to know whether they support bufferline and how to configure highlight groups.