diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/minitab.lua (renamed from lua/minitab/init.lua) | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lua/minitab/init.lua b/lua/minitab.lua index 22beb44..17acbbf 100644 --- a/lua/minitab/init.lua +++ b/lua/minitab.lua @@ -4,7 +4,7 @@ local M = { modifiedC = "+", } -M.title = function(bufnr, isSelected) +M.title = function(bufnr) local file = vim.fn.simplify(vim.fn.bufname(bufnr)) local tail = vim.fn.fnamemodify(file, ':t') local buftype = vim.fn.getbufvar(bufnr, '&buftype') @@ -30,9 +30,9 @@ M.modified = function(bufnr) end M.windowCount = function(index, hl) - local nwins = #vim.tbl_filter(function(winnr) - return vim.fn.win_gettype(winnr) == "" -- windows will appear or disappear at random when editing files etc for no discernible reason - end, vim.api.nvim_tabpage_list_wins(index)) + local nwins = #vim.tbl_filter(function(bufnr) + return vim.fn.win_gettype(vim.fn.bufwinid(bufnr)) == "" -- windows will appear or disappear at random when editing files etc for no discernible reason + end, vim.fn.tabpagebuflist(index)) return nwins > 1 and '%#TabLineSel#' .. nwins .. hl or "" end @@ -50,20 +50,19 @@ M.cell = function(index) local prefix = M.windowCount(index, hl) .. M.modified(bufnr) .. " " return hl .. '%' .. index .. 'T' .. " " .. (prefix == " " and "" or prefix) .. - M.title(bufnr, isSelected) .. " " .. + M.title(bufnr) .. " " .. M.separator(index) end M.tabline = function() local line = "" + if vim.fn.tabpagenr('$') <= 1 then + return line + end for i = 1, vim.fn.tabpagenr('$'), 1 do line = line .. M.cell(i) end - line = line .. '%#TabLineFill#%=' - if vim.fn.tabpagenr("$") > 1 then - line = line .. '%#TabLine#%999XX' - end - return line + return line .. '%#TabLineFill#%=%#TabLine#%999XX' end local setup = function(opts) |