nanozuki / tabby.nvim

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

Filter certain window labels / titles from appering in the bar #34

Closed ghillb closed 1 year ago

ghillb commented 2 years ago

A filter config key for certain windows to hide from the bar would be an useful addition.

An example would be the 'index' window label, when opening fugitives git status with :G or terminal window labels the user does not deem as valuable.

2021-12-28-140450_1501x70_scrot

On this pic, only the '[No name]' window label is useful to me.

nanozuki commented 1 year ago

I rewrite the config API in case to easily achieve this function. For example in setup, you can filter window like this:

line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
  if string.find(win.buf_name(), "^index") then
    return ''
  end
  ...
end),

If return an empty string, this window label won't be rendered.

nanozuki commented 1 year ago

If you want filter by buffer type, for example, don't display all 'nofile' buffer:

line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
  if win.buf().type == 'nofile' then
    return ''
  end
  ...
end),

If return an empty string, this window label won't be rendered.

You can check this for the detail of buf type: neovim help: buftype