nanozuki / tabby.nvim

A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
MIT License
584 stars 21 forks source link

feat: add buf is_changed #111

Closed PumpedSardines closed 1 year ago

PumpedSardines commented 1 year ago

Add a function to see if a buffer is changed or not. Can be used to show an indicator when there are unwritten changes.

Example of using is_changed()

line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
  return {
    line.sep(" ", theme.win, theme.fill),
    win.buf().is_changed() and "" or "",
    win.buf_name(),
    line.sep("", theme.win, theme.fill),
    hl = theme.win,
    margin = " ",
  }
end),
nanozuki commented 1 year ago

I think this is very useful, thank you!