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

Add buffer filter #86

Closed EpsilonKu closed 1 year ago

EpsilonKu commented 1 year ago

Bufferline.nvim (docs) has filter option. Also it filter when you navigate between buffers (because of custom :BufferLineCycleNext command). I know it's easy to make it. But I think it will really useful to make ready custom command and filter. I personally use it for nvim-dap (it create repl as buffer).

nanozuki commented 1 year ago

Sorry for the delay in my response due to the holidays. I think this feature is very useful just I haven't figured out a way to implement it yet. Thanks for the other plugins you provided for my reference.

I will reply to this issue on the progress of developing this feature.

In the current case, you can also use normal lua code to filter. Just return the empty string in the callback of line.wins().foreach({callback}) and the label of the win will not be rendered.

nanozuki commented 1 year ago

I want to add filters in line.wins({filters}).foreach({callback}), for example:

Users can define customer filters, receive win object return boolean:

function not_nvimtree(win)
  return not string.find(win.name(), "NvimTree")
end
line.wins(not_nvimtree).foreach(function
...
end)

And provide some built-in filters.

What do you think about it?

EpsilonKu commented 1 year ago

Yeah, sounds really cool. Better than bufferline.nvim.

mxxivcz commented 1 year ago

I'm wondering if such buffer filtering would allow to keep separate sets of buffers per tab, like it's possible with vim-ctrlspace. I do not use splits, only set of buffers in each tab. I always see just one buffer in a tab, but I can easily cycle thru the tab's buffers.

nanozuki commented 1 year ago

@EpsilonKu I complete this feature now. You can check the doc in tabby.line.wins().foreach(). Welcome to feedback on this issue!

nanozuki commented 1 year ago

@ajtakrajta This filter feature only changes the display in the tabline. Won't change the behavior in opening a buffer. Maybe you can add a custom command or something else to do this.