lazy.nvim icon indicating copy to clipboard operation
lazy.nvim copied to clipboard

bug: luochen1990/rainbow plugin not working at startup

Open vehlwn opened this issue 1 year ago • 4 comments

Did you check docs and existing issues?

  • [X] I have read all the lazy.nvim docs
  • [X] I have updated the plugin to the latest version before submitting this issue
  • [X] I have searched the existing issues of lazy.nvim
  • [X] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10.1

Operating system/version

Arch

Describe the bug

(Repost from https://github.com/luochen1990/rainbow/issues/196)

With vim-plug rainbow plugin worked well. But when I switched to lazy.nvim the plugin stopped working like it's ignoring rainbow_active = 1 and I have to manually call :RainbowToggle to activate it.

No highlighting when rainbow_active = 1:

Screenshot_20240801_184125

Steps To Reproduce

~/.config/nvim/init.lua:

-- Standard boilerplate from https://lazy.folke.io/installation
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
    local lazyrepo = "https://github.com/folke/lazy.nvim.git"
    local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
    if vim.v.shell_error ~= 0 then
        vim.api.nvim_echo({
            { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
            { out, "WarningMsg" },
            { "\nPress any key to exit..." },
        }, true, {})
        vim.fn.getchar()
        os.exit(1)
    end
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup("plugins")

~/.config/nvim/lua/plugins/rainbow.lua:

return {
    "luochen1990/rainbow",
    init = function()
        vim.g.rainbow_active = 1
        vim.g.rainbow_conf = {
            guifgs = {"Red", "Green", "Yellow"},
        }
    end
}

Expected Behavior

Parenthesis are highlighted:

Screenshot_20240801_184116

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
{
    "luochen1990/rainbow",
    init = function()
        vim.g.rainbow_active = 1
    end
}
  },
})

vehlwn avatar Aug 01 '24 15:08 vehlwn

This looks like a colorscheme issue. I use tokyonight with the following repro, and rainbow works without issue.

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
	spec = {
		{ "folke/tokyonight.nvim" },
		{
			"luochen1990/rainbow",
			init = function()
				vim.g.rainbow_active = 1
			end,
		},
	},
})
vim.cmd.colorscheme("tokyonight")

b0ae989c avatar Aug 01 '24 17:08 b0ae989c

I use tokyonight with the following repro, and rainbow works without issue.

Is rainbow enabled automatically? Your example doesn't work for me. I have to call :RainbowToggle twice to enable colors. Either with tokyonight or with any of vim's predefined theme. Also colors enabled when I change colorscheme after start e.g. :colorscheme vim.

PS: With vim-plug it worked well:

~/.config/nvim/init.vim:

call plug#begin()
Plug 'luochen1990/rainbow'
call plug#end()

let g:rainbow_active = 1

vehlwn avatar Aug 02 '24 01:08 vehlwn

Yes rainbow is enabled automatically with that repro.

b0ae989c avatar Aug 02 '24 02:08 b0ae989c

I tried repro.lua config on two different virtual machines with Arch and Cachyos but colors still not enabled on startup.

vehlwn avatar Aug 02 '24 05:08 vehlwn

not a lazy issue

folke avatar Aug 31 '24 07:08 folke