From 8a44866207c1411f65ee08440114f721f01f1a72 Mon Sep 17 00:00:00 2001 From: Alvaro Date: Sat, 18 May 2024 02:08:25 +0200 Subject: refactor window count --- lua/luatab/init.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lua') diff --git a/lua/luatab/init.lua b/lua/luatab/init.lua index e4967f4..0d4a86d 100644 --- a/lua/luatab/init.lua +++ b/lua/luatab/init.lua @@ -34,11 +34,7 @@ M.modified = function(bufnr) end M.windowCount = function(index) - local nwins = 0 - local success, wins = pcall(vim.api.nvim_tabpage_list_wins, index) - if success then - for _ in pairs(wins) do nwins = nwins + 1 end - end + local nwins = vim.fn.tabpagewinnr(index, '$') return nwins > 1 and '(' .. nwins .. ') ' or '' end -- cgit v1.2.3