Closed tan-wei closed 8 months ago
Hi tan-wei,
I think we need to add support for the plugin:
According to the documentation, there are 3 highlight groups:
In order to get good values as the defaults we need to figure out what works. The README has a on_highlights callback:
on_highlights = function(groups, colors)
groups.IblIndent = { fg = colors.xgray7, nocombine = true }
groups.IblScope = { fg = colors.magenta, nocombine = true }
end,
Can you test if that works for you?
I have tried the configuration, but it is not OK:
You can see the special characters are colored WHITE.
The other color scheme, for example tokyonight
:
Did you try setting IblWhitespace
?
Maybe try:
groups.IblIndent = { colors.xgray7, nocombine = true }
groups.IblWhitespace = { nocombine = true }
groups.IblScope = { fg = colors.magenta }
I'm afraid not:
I guess these characters below Special
group, so they are colored gray.
I can't reproduce what you see.
Here is a repro.lua
-- DO NOT change the paths
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',
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
'cryptomilk/nightcity.nvim',
-- add any other plugins here
'lukas-reineke/indent-blankline.nvim',
'nvim-treesitter/nvim-treesitter',
}
require('lazy').setup(plugins, {
root = root .. '/plugins',
})
require('nightcity').setup({
style = 'kabuki', -- The theme comes in two styles: kabuki or afterlife
terminal_colors = true, -- Use colors used when opening a `:terminal`
invert_colors = {
-- Invert colors for the following syntax groups
cursor = true,
diff = true,
error = true,
search = true,
selection = false,
signs = false,
statusline = true,
tabline = false,
},
font_style = {
-- Style to be applied to different syntax groups
comments = { italic = true },
keywords = { italic = true },
functions = { bold = true },
variables = {},
search = { bold = true },
},
-- Plugin integrations. Use `default = false` to disable all integrations.
plugins = { default = true },
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
---@param groups Highlight groups
---@param colors ColorScheme
on_highlights = function(groups, colors)
groups.IblIndent = { fg = colors.xgray7 }
groups.IblScope = { fg = colors.magenta }
groups.IblWhitespace = { nocombine = true }
end,
})
vim.cmd.colorscheme('nightcity')
-- add anything else here
vim.o.list = true
vim.opt.listchars = {
tab = '»·',
trail = '•',
extends = '…',
nbsp = '␣',
}
require('nvim-treesitter.configs').setup({
ensure_installed = { 'lua' },
})
vim.cmd('TSUpdate')
require("ibl").setup()
local test = {
wurst = {
brot = true,
wurstbrot = true,
wurst = true,
}
}
nvim -u repro.lua
This doesn't show any of the white stuff you have.
It would be great if you could modify the reproducer with your stuff. Then I can reproduce it here.
OK, I'll try to write a minimum configure reproduce this.
Here is the minimum configure to reproduce this:
-- DO NOT change the paths
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",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"cryptomilk/nightcity.nvim",
-- add any other plugins here
"lukas-reineke/indent-blankline.nvim",
"nvim-treesitter/nvim-treesitter",
"HiPhish/rainbow-delimiters.nvim",
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
require("nightcity").setup({
style = "kabuki", -- The theme comes in two styles: kabuki or afterlife
terminal_colors = true, -- Use colors used when opening a `:terminal`
invert_colors = {
-- Invert colors for the following syntax groups
cursor = true,
diff = true,
error = true,
search = true,
selection = false,
signs = false,
statusline = true,
tabline = false,
},
font_style = {
-- Style to be applied to different syntax groups
comments = { italic = true },
keywords = { italic = true },
functions = { bold = true },
variables = {},
search = { bold = true },
},
-- Plugin integrations. Use `default = false` to disable all integrations.
plugins = { default = true },
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
---@param groups Highlight groups
---@param colors ColorScheme
on_highlights = function(groups, colors)
groups.IblIndent = { fg = colors.xgray7 }
groups.IblScope = { fg = colors.magenta }
groups.IblWhitespace = { nocombine = true }
end,
})
vim.cmd.colorscheme("nightcity")
-- add anything else here
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
require("nvim-treesitter.configs").setup({
ensure_installed = { "lua" },
})
vim.cmd("TSUpdate")
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local ibl = require("ibl")
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)
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
vim.g.rainbow_delimiters = { highlight = highlight }
ibl.setup({
indent = { char = { "|", "¦", "┆", "┊" }, tab_char = { "»" }, smart_indent_cap = true, priority = 50 },
scope = {
show_start = true,
show_end = true,
highlight = highlight,
char = { "▏" },
},
whitespace = { highlight = { "Whitespace", "NonText" }, remove_blankline_trail = true },
exclude = {
filetypes = {
"",
"NvimTree",
"Outline",
"TelescopePrompt",
"Trouble",
"Ultest*",
"alpha",
"dapui*",
"dashboard",
"dbui",
"floaterm",
"flutterToolsOutline",
"fugitive*",
"git*",
"help",
"lazy",
"log",
"lspinfo",
"mason",
"neogit*",
"org*",
"packer",
"startify",
"term",
"undotree",
"vista",
},
buftypes = { "terminal", "nofile" },
},
})
local test = {
wurst = {
brot = true,
wurstbrot = true,
wurst = true,
},
}
Is that because line? I use Whitespace
and NonText
as highlight groups here.
whitespace = { highlight = { "Whitespace", "NonText" }, remove_blankline_trail = true },
Update: Yes, remove this line will make indent line spaces works, but ↴
does not.
Yeah, ↴
is NonText. It is not something which I use so this is why it looks ugly :-)
I guess we want it the same as Whitespace
. What do you think?
Just set in on_highlights:
groups.NonText = groups.Whitespace
Now it is OK after add groups.NonText = groups.Whitespace
.
Thanks for your reply.
Maybe a better way is support indent-blankline.nvim
as an extension support. Now the issue should be closed.
Thanks for confirming. I've pushed all the fixes and improvements to the repo. I also added support for rainbow-delimiters I missed it. You can remove the defninitions from your config too.
As a sidenote I prefer mini.indentscope over indent-blanklines. It works much better in my opinion.
In case you want support for other plugins, the repro.lua is in the extras directory now :-)
Great! I can confirm now the special configuration is not needed.
Hmm, I guess the poor performance for indent-blinkline.nvim
is the reason that you prefer mini.indentscope
. Is that true?
Finally, thanks very much!
mini.indentscope works with listchar options and also with code structures. From the reproducer, I saw that indent-blankline didn't work with sturctures. Maybe there is an option, I didn't check.
Because indent-blankline.nvim use treesitter as dependency, it just regards the "REAL" scope as a scope. For lua table, it does not create a real scope (just like Python if
statements, I guess.
Update: I find an issue, which can confirm my guess: https://github.com/lukas-reineke/indent-blankline.nvim/issues/643
For example, I use
indent-blankline.nvim
with some special charcters:It will be colored white which makes the colorschme not that pretty. I understand we could use
setup
to override the color for a given group, but I think it will be nice to make the default colors more widely used with other plugins.