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

tabby.nvim 2.0 #82

Closed nanozuki closed 1 year ago

nanozuki commented 1 year ago

The problems in the current version:

  1. High-level APIs are difficult to combine and customize. And the low-level APIs are too primitive, difficult to use, and imperative API.
  2. The rendering definition is not systematic enough and does not support nesting and combination. Therefore it is difficult to provide new features, and it is difficult for users to add custom components.
  3. Integrating with the "showtabline" option in nvim makes it difficult for tabby to work with user configurations and other plugins.
  4. Lack of configuration tools and APIs, so much so that the user needs to learn the nvim API that he rarely uses.
  5. More than expected uses use the presets configuration, but the presets lack design and maintenance.
  6. Highlights will be corrupted by theme loading or changing.

After nearly a year of use, maintenance and feedback, I understand tabby's usage scenarios and requirements much more clearly. Now it's time to improve them and develop a new version.

Based on the problems exposed so far, the next version should have the following goals:

  1. Improve the declarative configuration approach and rendering system: support for nesting and combination. And merge the high-level and low-level APIs into one set of APIs.
  2. Provide a series of helper functions to reduce the burden on the user.
  3. Add on features whose delayed due to previous design difficulties.
  4. No longer set nvim's showtabline option in tabby.
  5. Give the presets config some necessary options, such as the theme and separator style.
  6. Support "dynamic" update of highlight extract.

One more thing that I think is important: tabby needs to remain backward compatible (at least one year).

Here is a example of next version config:

tabline.set(function(line)
  return {
    {
      { '  ', hl = opt.theme.head },
      line.sep('', opt.theme.head, opt.theme.fill),
    },
    line.tabs().foreach(function(tab)
      local hl = tab.is_current() and opt.theme.current_tab or opt.theme.tab
      return {
        line.sep('', hl, opt.theme.fill),
        tab.is_current() and '' or '',
        tab.number(),
        tab.name(),
        tab.close_btn(''),
        line.sep('', hl, opt.theme.fill),
        hl = hl,
        margin = ' ',
      }
    end),
    line.spacer(),
    line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
      return {
        line.sep('', opt.theme.win, opt.theme.fill),
        win.is_current() and '' or '',
        win.buf_name(),
        line.sep('', opt.theme.win, opt.theme.fill),
        hl = opt.theme.win,
        margin = ' ',
      }
    end),
    {
      line.sep('', opt.theme.tail, opt.theme.fill),
      { '  ', hl = opt.theme.tail },
    },
    hl = opt.theme.fill,
  }
end, opt)

close #33 #43 #42 #45