staline.nvim icon indicating copy to clipboard operation
staline.nvim copied to clipboard

Highlight groups do not activate on start

Open anir-baaaan opened this issue 11 months ago • 4 comments

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

anir-baaaan avatar Mar 08 '24 16:03 anir-baaaan

With solution image image

Without solution image image

anir-baaaan avatar Mar 08 '24 16:03 anir-baaaan

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

tamton-aquib avatar Mar 08 '24 17:03 tamton-aquib

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

tamton-aquib avatar Mar 08 '24 17:03 tamton-aquib

@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! :)

anir-baaaan avatar Mar 08 '24 17:03 anir-baaaan