-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indent blankline v3 #612
Indent blankline v3 #612
Conversation
vim.api.nvim_create_autocmd("ColorScheme", { | ||
group = group, | ||
pattern = "*", | ||
callback = function() | ||
highlights.setup() | ||
ibl.refresh_all() | ||
end, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a bit strict?
I cannot for example use a custom hlg, which is not set by the colorscheme itself.
minimal.lua
:
-- 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)
vim.cmd [[hi MyHLG guifg=red]]
-- install plugins
local plugins = {
{
"lukas-reineke/indent-blankline.nvim",
branch = "v3",
config = function()
require("ibl").setup {
indent = { highlight = "MyHLG" },
}
end
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd [[set termguicolors]]
Now when I run for example colorscheme default
, it clears MyHLG
, and when the autocommand runs it errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use the HIGHLIGHT_SETUP
hook, it's explained in the readme and the docs
https://github.com/lukas-reineke/indent-blankline.nvim/tree/v3#multiple-indent-colors
For the visual selection, I can't reproduce that. Please open an issue with steps to get there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yes you are right. I just skimmed :h ibl.setup()
(as recommended) and scrolled to config.indent
. Out of curiosity — is there a reason why hooks are necessary here? None of other plugins I use with custom hl groups require that (tzachar/highlight-undo.nvim
, winston0410/range-highlight.nvim
, folke/flash.nvim
to name a few), and their config is more concise.
About the highlighting — I'm not sure it is an "issue" per see, but side effect of how highlights are handled as well. Try this
local root = vim.fn.fnamemodify("./.repro", ":p")
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
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)
local plugins = {
"RRethy/nvim-base16",
{
"lukas-reineke/indent-blankline.nvim",
branch = "v3",
config = function()
require("ibl").setup { }
end
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd [[set termguicolors]]
vim.cmd [[colorscheme base16-dirtysea]]
vim.opt.background = "light"
vim.api.nvim_set_hl(0, "NonText", { fg = "Gray", bg = "bg" })
Anyway, thanks for the hard work on this plugin!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's not ideal, but I don't see a better way. Because there can be different colors for the indent guides, the scope, and the whitespace, I need to generate all combinations for all cases where they are used.
Otherwise, to have 3 colors each, the user would need to manually make 42 highlight groups. That would be much less user-friendly.
Even with just one color each, I still need to create 7 highlight groups.
BREAKING CHANGES please see https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3 for a migration guide
See https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3