add options for tabufline : enabled, lazyload, override | fix (#1274)

This commit is contained in:
siduck 2022-06-27 07:16:33 +05:30
parent 9c07c5c2ed
commit 33550e9587
4 changed files with 33 additions and 18 deletions

View file

@ -28,7 +28,11 @@ M.ui = {
},
-- lazyload it when there are 1+ buffers
tabufline_lazyloaded = true,
tabufline = {
enabled = true,
lazyload = true,
override = {},
},
}
M.plugins = {

View file

@ -72,9 +72,11 @@ autocmd("BufDelete", {
end,
})
if require("core.utils").load_config().ui.tabufline_lazyloaded then
local tabufline_opts = require("core.utils").load_config().ui.tabufline
if tabufline_opts.enabled and tabufline_opts.lazyload then
require("core.lazy_load").tabufline()
else
elseif tabufline_opts.enabled then
vim.opt.showtabline = 2
vim.opt.tabline = "%!v:lua.require'ui.tabline'.run()"
end

View file

@ -228,15 +228,16 @@ M.tabuflinePrev = function()
end
end
end
-- closes tab + all of its buffers
M.tabuflineCloseTab = function()
M.closeAllBufs = function(action)
local bufs = vim.t.bufs or {}
vim.cmd "tabclose"
for _, buf in ipairs(bufs) do
vim.cmd("bd" .. buf)
M.close_buffer(buf)
end
vim.cmd(action == "closeTab" and "tabclose" or "enew")
end
return M