aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2021-07-10 12:05:57 +0800
committerzeertzjq <zeertzjq@outlook.com>2021-07-10 12:05:57 +0800
commit424771fc1e8f5d76251e7a3b5ecac8f0286c7230 (patch)
tree464a51cba0a00d9d002097bf3ef3dcf2979800d0
parent540362f44bc17ae8101828eec00fd00ffc4148bb (diff)
downloadminitab.nvim-424771fc1e8f5d76251e7a3b5ecac8f0286c7230.tar.xz
minitab.nvim-424771fc1e8f5d76251e7a3b5ecac8f0286c7230.zip
Make tabs clickable and add close current tab button
-rw-r--r--lua/luatab/init.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/lua/luatab/init.lua b/lua/luatab/init.lua
index 597af3a..92fa05e 100644
--- a/lua/luatab/init.lua
+++ b/lua/luatab/init.lua
@@ -64,11 +64,11 @@ local function formatTab(current)
local bufnr = buflist[winnr]
local hl = (isSelected and '%#TabLineSel#' or '%#TabLine#')
- return hl .. ' ' ..
+ return hl .. '%' .. current .. 'T' .. ' ' ..
tabWindowCount(current) ..
tabName(bufnr) .. ' ' ..
tabModified(bufnr) ..
- tabDevicon(bufnr, isSelected) ..
+ tabDevicon(bufnr, isSelected) .. '%T' ..
tabSeparator(current)
end
@@ -79,7 +79,11 @@ local function tabline()
line = line .. formatTab(i)
i = i + 1
end
- return line .. '%T%#TabLineFill#%='
+ line = line .. '%#TabLineFill#%='
+ if vim.fn.tabpagenr('$') > 1 then
+ line = line .. '%#TabLine#%999XX'
+ end
+ return line
end
local M = {