nanozuki / tabby.nvim

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

Why it's `win.buf().id` not `win.buf.id`? #96

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

As title. First, I appreciate this beautiful plugin and have a good time doing the customization. But regarding the coding part, It took me some time debugging to realize that tabbywin.buf is actually a function instead of a field. That is, the working code looks kinda cumbersome:

line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
  if not vim.api.nvim_buf_get_option(win.buf().id, 'buflisted') then return {} end
--                                        ^here

(In this code I assumed win should mean tabby-win as per your documentation)


At first, this is more of an aesthetic problem with the code. But then I notice that your documentation also said tabby.buf.id. Could you elaborate more on this part?

nanozuki commented 1 year ago

win.buf() is smillar to tab.current_win(), line.tabs(). These functions means "new tabby-buf object", "new tabby-win object," and "new tabby-tab object array". I want to lazily calculate and build tabline. The tabby.buf.id in the document should be a mistake.

nyngwang commented 1 year ago

Got it, then you can safely close this issue!