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

Cannot specify highlight group for user defined sections

Open ansipunk opened this issue 1 year ago • 2 comments

I have a custom section like following. I also tried returning only the path, so my middle group would be either like mid = { { 'StalineFile', section_filename } } or mid = { section_filename }.

local function section_filename()
    local dir = vim.fn.expand('%:p:h:t')
    local file = vim.fn.expand('%:t')
    local path = string.format('%s/%s', dir, file)
    if vim.bo.modifiable and vim.bo.modified then path = path .. '*' end
    if vim.bo.readonly then path = ' ' .. path end
    return { 'StalineFile', path }
end

However, in the first case I get this: image

And in the second case this: image

ansipunk avatar Aug 02 '22 16:08 ansipunk

Heyyo @xdeafbabe , i havent set parse function to accept highlight+function yet. Will be implementing it shortly 😅

tamton-aquib avatar Aug 03 '22 11:08 tamton-aquib

I have sent a fix, let me know if it works when you have time😅

tamton-aquib avatar Aug 03 '22 12:08 tamton-aquib

@tamton-aquib It works just as I expected it to, thank you a lot!

ansipunk avatar Aug 03 '22 23:08 ansipunk