Skip to content
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

Highlight groups do not activate on start #61

Open
axviii3 opened this issue Mar 8, 2024 · 4 comments
Open

Highlight groups do not activate on start #61

axviii3 opened this issue Mar 8, 2024 · 4 comments

Comments

@axviii3
Copy link

axviii3 commented Mar 8, 2024

Problem: The statusbar uses nvim default statusbar highlight colours on start and only uses defined colors when a editable buffer is opened

Possible Explanation: The get_statusline() function in the staline.nvim file contains an if statement at the beginning which might be barring the colours to set up on non editable buffers like the dashboard, netrw or help

Possible Solution: Move the call_highlights() function call above the if statement in the function

M.get_statusline = function(status)
local mode = vim.api.nvim_get_mode()['mode']
local fgColor = status and conf.mode_colors[mode] or t.inactive_color
local bgColor = status and t.bg or t.inactive_bgcolor

call_highlights(fgColor, bgColor)

if conf.special_table[vim.bo.ft] ~= nil then
local special = conf.special_table[vim.bo.ft]
return "%#Staline#%=" .. special[2] .. special[1] .. "%="
end

M.sections = {}

local modeIcon = conf.mode_icons[mode] or "󰋜 "

local f_name = t.full_path and '%F' or '%t'
-- TODO: original color of icon
local f_icon = util.get_file_icon(vim.fn.expand('%:t'), vim.fn.expand('%:e'))
local edited = vim.bo.mod and t.mod_symbol or ""
-- TODO: need to support b, or mb?
local size = ("%.1f"):format(vim.fn.getfsize(vim.api.nvim_buf_get_name(0))/1024)

.
.
.
end

Solution solves problem: Yes

Side effects: Unknown

@axviii3
Copy link
Author

axviii3 commented Mar 8, 2024

With solution
image
image

Without solution
image
image

@tamton-aquib
Copy link
Owner

Thank you for the detailed explanation. I'll look this weekend 👍🏻

@tamton-aquib
Copy link
Owner

tamton-aquib commented Mar 8, 2024

Although I feel like its a colorscheme loading issue. If your using lazy.nvim (package manager) check with event="Colorscheme" or priority

@axviii3
Copy link
Author

axviii3 commented Mar 8, 2024

@tamton-aquib
Yeah sure! Take your time...

I am fairly certain it isnt... I have tried calling the functions manually... event Colorscheme doesnt work and my colorscheme (navarasu/onedark) is already set to priority 1000 which is the highest in my config..

Cheers! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants