You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to wrap my head around this code, but it (the head) is exploding :)
I am not a programmer, barely know basics.
Have almost the whole heirline done, except this. The following works, but the mode colors need to refresh on colorscheme change like the first ones do. I just don't know how to place them in the setup_colors function, which does the refreshing at the bottom. I tired everything, but these metatables and metafunctions are too complicated for me.
local utils = require('heirline.utils')
local get_hl = utils.get_highlight
local function setup_colors()
return {
filename = get_hl('Normal').fg,
modified = get_hl('Number').fg,
workdir = get_hl('Tag').fg,
filetype = get_hl('Type').fg,
blablabla
blablabla
}
end
-- Mode colors
do
local mode_colors = {
normal = get_hl('StatusLine').fg,
insert = get_hl('Number').fg,
visual = get_hl('Type').fg,
blablabla
blablabla
}
Mode = setmetatable({
normal = { fg = "statusline_bg" }
}, {
__index = function(_, mode)
return {
fg = "statusline_bg",
bg = mode_colors[mode],
bold = true
}
end
})
end
require("heirline").load_colors(setup_colors)
vim.api.nvim_create_augroup("Heirline", { clear = true })
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
utils.on_colorscheme(setup_colors)
end,
group = "Heirline",
})
blablabla is just the rest of the colors...
The colors adapt to my colorscheme, so it's very nice.
If you want I can upload the whole thing, but it almost looks like the cookbook.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to wrap my head around this code, but it (the head) is exploding :)
I am not a programmer, barely know basics.
Have almost the whole heirline done, except this. The following works, but the mode colors need to refresh on colorscheme change like the first ones do. I just don't know how to place them in the setup_colors function, which does the refreshing at the bottom. I tired everything, but these metatables and metafunctions are too complicated for me.
blablabla is just the rest of the colors...
The colors adapt to my colorscheme, so it's very nice.
If you want I can upload the whole thing, but it almost looks like the cookbook.
Beta Was this translation helpful? Give feedback.
All reactions