b0o / incline.nvim

🎈 Floating statuslines for Neovim, winbar alternative
MIT License
759 stars 14 forks source link

Change indicator support? #47

Closed craftzdog closed 11 months ago

craftzdog commented 11 months ago

Hi! I love this plugin.

It would be great to have indicators on the changed files like * filename.lua. Is it possible?

fitrh commented 11 months ago

IIRC the default renderer will return [+] bufname if the buffer is modified.

If you want to change it, you can use the render config

require('incline').setup({
  render = function(props)
    local bufname = vim.api.nvim_buf_get_name(props.buf)
    local res = bufname ~= '' and vim.fn.fnamemodify(bufname, ':t') or '[No Name]'
    if vim.bo[props.buf].modified then
      res = '* ' .. res
    end
    return res
  end,
})
craftzdog commented 11 months ago

That works. Thank you @fitrh !