GithubHelp home page GithubHelp logo

Comments (6)

lukas-reineke avatar lukas-reineke commented on June 3, 2024 1

If you lazy load ibl after rainbow delimiters, and you create the highlight groups inside the ibl setup, rainbow delimiters will not have any highlighting set when it initializes. It falls back to the default, and the highlights won't match that of ibl.

You need to either, create the highlight groups first, before you load any plugins, or keep it as you have now, but load rainbow delimiters after ibl.

from indent-blankline.nvim.

lukas-reineke avatar lukas-reineke commented on June 3, 2024

Using this minimal init.lua, I can't reproduce the problem.
Can you check if anything in your config might conflict?

The hook for scope highlight from extmark changed in #802, but I can't immediately see what could make the new one fail if the old one works.

local lazypath = "/tmp/lazy/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", "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
vim.opt.termguicolors = true

require("lazy").setup ({
    {
        "hiphish/rainbow-delimiters.nvim"
    },
    {
        "lukas-reineke/indent-blankline.nvim",
        main = "ibl",
        config = function()
            local highlight = {
                "RainbowRed",
                "RainbowYellow",
                "RainbowBlue",
                "RainbowOrange",
                "RainbowGreen",
                "RainbowViolet",
                "RainbowCyan",
            }
            local hooks = require "ibl.hooks"
            -- create the highlight groups in the highlight setup hook, so they are reset
            -- every time the colorscheme changes
            hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
                vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
                vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
                vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
                vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
                vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
                vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
                vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
            end)

            vim.g.rainbow_delimiters = { highlight = highlight }
            require("ibl").setup { scope = { highlight = highlight } }

            hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
        end
    },
    -- uncomment this if the problem is related to scope
    {
        "nvim-treesitter/nvim-treesitter",
        build = ":TSUpdate",
        config = function()
            require("nvim-treesitter.configs").setup {
                ensure_installed = { "rust" }, -- change this to the language you use
            }
        end,
    },
}, { root = "/tmp/lazy" })

from indent-blankline.nvim.

tan-wei avatar tan-wei commented on June 3, 2024

Hmm. With the minimal init.lua, I can't reproduce the problem, either.

So it must be my own problem in my configuration. I'll try to find the confilict.

from indent-blankline.nvim.

tan-wei avatar tan-wei commented on June 3, 2024

I think I find the method how to make it work. Both of them should be applied at the same time:

  1. Disable lazy loading for ibl. Before changed, I use event = "VeryLazy" to make it lazy load (update: Changed it into BufEnter just the same with rainbow-delimiters.nvim is OK, does it mean rainbow-delimiters.nvim may conflict with ibl?)
  2. set vim.g.rainbow_delimiters like the minimal init.lua in config file. Before changed, I set it in init function, which is set before config function is called

But I can't find why these steps work.

from indent-blankline.nvim.

tan-wei avatar tan-wei commented on June 3, 2024

The issue should be closed. Thanks @lukas-reineke .

from indent-blankline.nvim.

tan-wei avatar tan-wei commented on June 3, 2024

Got it. Lazy load could cause some issues like this. Thanks for your reply.

from indent-blankline.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.