Does not respect new colorscheme if not lazy-loaded
gregorias opened this issue · comments
The issue
The plugin doesn't work if it's not lazy-loaded. It doesn't start with a bold cursorline number, doesn't change colors. It looks like this:
Normal mode (the color should be different and the number should be bold)
![immediately after start](https://private-user-images.githubusercontent.com/722385/278879706-7ed74033-f753-4139-a04b-1af5ca0fb864.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNzE1MjEsIm5iZiI6MTcyMTM3MTIyMSwicGF0aCI6Ii83MjIzODUvMjc4ODc5NzA2LTdlZDc0MDMzLWY3NTMtNDEzOS1hMDRiLTFhZjVjYTBmYjg2NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQwNjQwMjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05M2E1ZDU0MDY0ZjE2OTJiMTVlNTY3YzlmODNiODgyNWQyNzc1NDcxMGQ5ZjQyNjliZTYzMTY5M2EwMGZjYjBmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.geesro2XFAjwnZ-wjGQBdX7MtwV0DAKB7SoprJCoAMo)
Insert mode (the color should be green):
![image](https://private-user-images.githubusercontent.com/722385/278879726-c76f31cb-d568-4828-b8a2-b8e445e4f638.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNzE1MjEsIm5iZiI6MTcyMTM3MTIyMSwicGF0aCI6Ii83MjIzODUvMjc4ODc5NzI2LWM3NmYzMWNiLWQ1NjgtNDgyOC1iOGEyLWI4ZTQ0NWU0ZjYzOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQwNjQwMjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03MGUwMjdiNzc2MzM0YWQwOGIyNjQyMTI0MDZmYWE0ZGI0ZGM4NjFmMGMzMzdkZTVjYTVmYzI1MWIwNDZlYjQ0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.3Um64jwLFhpBNDp0QhfX1kpnm2_V2yYjR2TebdWdtnk)
Visual mode (the color should be purple):
![image](https://private-user-images.githubusercontent.com/722385/278879775-31da0858-124c-4d95-9358-bec3c4dafb84.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzNzE1MjEsIm5iZiI6MTcyMTM3MTIyMSwicGF0aCI6Ii83MjIzODUvMjc4ODc5Nzc1LTMxZGEwODU4LTEyNGMtNGQ5NS05MzU4LWJlYzNjNGRhZmI4NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQwNjQwMjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jYjI2ZDE3MzRiYzkzNDlmZTIxMTg3MjgxOTVkZjI5MTRiYzY1YTY5NzA3Mjk1MmI1MTJiMzU1YjM0NjEzZDRkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Nn01vfB_nl4l0IuC7R-2OIAjuNaCH1YqVynXX3UPV-o)
Reproduction
- Use the init.lua below
vim.o.cursorline = true
vim.o.number = true
vim.o.termguicolors = true
-- | Fetches Lazy if not present.
local function bootstrap_lazy()
local lazypath = vim.fn.stdpath("data") .. "/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)
end
bootstrap_lazy()
require("lazy").setup({
{
"folke/tokyonight.nvim",
},
{
"hoob3rt/lualine.nvim",
opts = {},
},
{
"mawkler/modicator.nvim",
dependencies = { "folke/tokyonight.nvim" },
opts = {
highlights = {
defaults = { bold = true },
},
},
},
})
vim.cmd("colorscheme tokyonight")
- Run nvim (possibly twice to let Lazy load its plugins)
Additional comments
The colors work fine if I load the plugin on "VeryLazy", BUT the number not being bold on initial load still remains.
@gregorias It seems like the problem is that you set the colorscheme after loading all plugins (including modicator.nvim). I changed your config like this, which works for me:
require("lazy").setup({
{
"folke/tokyonight.nvim",
config = function()
vim.cmd.colorscheme("tokyonight")
end,
},
{
"hoob3rt/lualine.nvim",
opts = {},
},
{
"mawkler/modicator.nvim",
dependencies = { "folke/tokyonight.nvim" },
opts = {
highlights = {
defaults = { bold = true },
},
},
},
})
I'll close this issue, but please let me know if you have any more issues 🙂
This doesn't work for me.
- The lack of boldness still remains.
- I don't think it's reasonable to require colorscheme being loaded during plugin load. It makes the plugin unusable for me, for example, because I have a script that changes my colorscheme during run time depending on whether I'm in light or dark mode.
@gregoriasI'm refactoring the lualine integration, and I think I've solved both these issues. Please try the branch lualine-refactor
, which if you're using lazy.nvim can be done like so, followed by a :Lazy update
:
{
'mawkler/modicator.nvim',
branch = 'lualine-refactor', -- <---
init = function()
vim.o.cursorline = true
vim.o.number = true
vim.o.termguicolors = true
end,
opts = {}
},
Does that solve your issue?
Yep, works splendidly.