So I was setting up my status line and I wanted a function which gives the icon of current file type. But it has to be in string.
provider=function()
str="{some icon}"
return str
end
so far so good
But now I need colored ones because why not?
So I came across something like this
provider=function()
local str = {}
str.str = "{some_icon}"
str.hl = {fg="#FFFFFF",}
return str
end
but now str is not a string.
Is there a way to convert it to string while keeping its color? Or all together is there a better way to get a colored icon as string? And also without loading any plugins.
I use feline plugin to setup the statusline....below is an example for a component config
vim_status = {
provider = function()
local s
if require('lazy.status').has_updates() then
s = require('lazy.status').updates()
else
s = ' '
end
s = string.format(' %s', s)
return s
end,
hl =vi_mode_hl ,
right_sep = {
always_visible = true,
str = "",
hl = vi_sep_hl,
},
},
I want to pass the icon to the provider field and this takes only string values
statusline
option. It would be good if you could share the code that set your status line.