Minimal Status Line Bug
monsonjeremy opened this issue · comments
Here's what I found in my repo helped fix the issue for me.
In my packer
config I did the following
use {
'monsonjeremy/onedark.nvim',
config = function()
local utils = require('utils')
require('plugins.onedark').setupOneDark()
utils.apply_colorscheme("onedark", "dark")
end
}
and then inside of plugins.onedark
I have
local M = {}
function M.setupOneDark()
local utils = require('utils')
utils.apply_globals({
onedark_hide_inactive_statusline = true,
})
end
return M
and utils:
local M = {}
function M.apply_globals(globals)
for k, v in pairs(globals) do vim.g[k] = v end
end
function M.apply_colorscheme(name, mode)
M.apply_options({
termguicolors = true,
background = mode
})
M.apply_globals({
colors_name = name
})
vim.api.nvim_command('colorscheme ' .. name)
end
return M
Basically what I believe to be the issue is that the onedark_hide_inactive_statusline
was not being set in time which was causing the highlights to be applied improperly. In order to fix that I tried to make sure that the value was set before the colorscheme
was set.
try to set onedark_hide_inactive_statusline
option individually to vim.g
. This works for me (video attached).
onedark_statusline.mp4
Here is how I did in my .vimrc
vim.g.onedark_hide_inactive_statusline = true
-- Load the colorscheme
vim.cmd [[colorscheme onedark]]
Or using packer
config
use {
"ful1e5/onedark.nvim",
config = function()
vim.g.onedark_hide_inactive_statusline = true
-- Load the colorscheme
vim.cmd [[colorscheme onedark]]
end
}
@monsonjeremy Try to set the lualine config before onedark config.
Hmm I can give that a try. It seems to me ultimately that using packer.nvim
is part of the problem since it lazy-loads configuration/plugins. Is that incorrect?
packer.nvim
lazy load works fine for me. As I said, This bug can be reproduced by changing the lualine and onedark 'config order'.
onedark_statusline_bug_reproduce.mp4
Here's my config:
use {
'hoob3rt/lualine.nvim',
config = function()
print('lualine')
require 'plugins.lualine'
end
}
use {
'monsonjeremy/onedark.nvim',
after = 'lualine.nvim',
config = function()
local utils = require('utils')
print('onedark')
require('plugins.onedark').setupOneDark()
utils.apply_colorscheme("onedark", "dark")
end
}
I controlled the order in which the configurations execute, but it still doesn't work properly. I can see that the :messages
prints as:
lualine
onedark
It works with your fork of my package, but not with mine 🤔
Do you know if you changed anything that might have had an effect on that?