diff options
author | Tim Keller <tjkeller.xyz> | 2024-11-28 11:53:51 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-11-28 11:53:51 -0600 |
commit | 53921c4f2b2ef868b1bed70bc11ab330b0ad4a47 (patch) | |
tree | d292afac7bb9d32f22838f6d9cb136fc5d9e10b4 /lua | |
parent | 4e6ad07b4bd217e9fb44d99225b3467d5c5f33f1 (diff) | |
download | minitab.nvim-53921c4f2b2ef868b1bed70bc11ab330b0ad4a47.tar.xz minitab.nvim-53921c4f2b2ef868b1bed70bc11ab330b0ad4a47.zip |
readme updated and minitab fixed
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) |