MunifTanjim / nougat.nvim

🍫 Hyperextensible Statusline / Tabline / Winbar for Neovim 🚀
MIT License
197 stars 3 forks source link

feat(nut): add tab.winlist #83

Closed MunifTanjim closed 8 months ago

MunifTanjim commented 8 months ago
local core = require("nougat.core")
local color = require("nougat.color").get()

local nut = {
  tab = {
    tablist = {
      tabs = require("nougat.nut.tab.tablist").create,
      close = require("nougat.nut.tab.tablist.close").create,
      number = require("nougat.nut.tab.tablist.number").create,
      win_count = require("nougat.nut.tab.tablist.win_count").create,
    },
    winlist = {
      wins = require("nougat.nut.tab.winlist").create,
      label = require("nougat.nut.tab.winlist.label").create,
    },
  },
}

local tal = Bar("tabline")

tab list (tab number + win list)

image
Expand Codes ```lua tal:add_item(nut.tab.tablist.tabs({ active_tab = { hl = { bg = color.bg0, fg = color.fg0 }, sep_left = { hl = { bg = color.bg0, fg = color.blue }, content = "▎", }, content = { nut.tab.tablist.number({ suffix = " " }), nut.tab.tablist.close({ config = { text = "󰅖" }, suffix = " " }), nut.tab.winlist.wins({ active_item = { hl = { bg = color.bg1, fg = color.blue }, prefix = " ", suffix = " ", content = { nut.tab.winlist.label({}), }, }, inactive_item = { hl = { bg = color.bg2, fg = color.fg2 }, prefix = " ", suffix = " ", content = { nut.tab.winlist.label({}), }, }, }), }, }, inactive_tab = { hl = { bg = color.bg2, fg = color.fg2 }, sep_left = { hl = { bg = color.bg2, fg = color.fg3 }, content = "▎", }, content = { nut.tab.tablist.number({ suffix = " " }), nut.tab.tablist.close({ config = { text = "󰅖" }, suffix = " " }), nut.tab.winlist.wins({ active_item = { hl = { bg = color.bg1, fg = color.blue }, prefix = " ", suffix = " ", content = { nut.tab.winlist.label({}), }, }, inactive_item = { hl = { bg = color.bg2, fg = color.fg2 }, prefix = " ", suffix = " ", content = { nut.tab.winlist.label({}), }, }, }), }, }, })) ```

win list (for active tab) + tab list (tab number + win count)

image
Expand Codes ```lua tal:add_item(nut.tab.winlist.wins({ active_item = { hl = { bg = color.bg1, fg = color.blue }, prefix = " ", suffix = " ", content = { nut.tab.winlist.label({}), }, }, inactive_item = { hl = { bg = color.bg2, fg = color.fg2 }, prefix = " ", suffix = " ", content = { nut.tab.winlist.label({}), }, }, })) tal:add_item(core.spacer()) tal:add_item(nut.tab.tablist.tabs({ active_tab = { hl = { bg = color.bg0, fg = color.fg0 }, sep_left = { hl = { bg = color.bg0, fg = color.blue }, content = "▎", }, content = { nut.tab.tablist.number({ suffix = " " }), nut.tab.tablist.close({ config = { text = "󰅖" }, suffix = " " }), }, }, inactive_tab = { hl = { bg = color.bg2, fg = color.fg2 }, sep_left = { hl = { bg = color.bg2, fg = color.fg3 }, content = "▎", }, content = { nut.tab.tablist.number({ suffix = " " }), nut.tab.tablist.win_count({ prefix = "(", suffix = ") " }), nut.tab.tablist.close({ config = { text = "󰅖" }, suffix = " " }), }, }, })) ```

vim.go.showtabline = 2
nougat.set_tabline(tal)
codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (dc84120) 100.00% compared to head (093cd59) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #83 +/- ## ========================================== Coverage 100.00% 100.00% ========================================== Files 38 42 +4 Lines 2572 2712 +140 ========================================== + Hits 2572 2712 +140 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.