diff --git a/lua/buffalo/init.lua b/lua/buffalo/init.lua index 1961792..c6485c2 100644 --- a/lua/buffalo/init.lua +++ b/lua/buffalo/init.lua @@ -2,7 +2,6 @@ local Dev = require("buffalo.dev") local api = require("buffalo.api") local log = Dev.log local buffer_is_valid = require("buffalo.utils").buffer_is_valid -local tab_is_valid = require("buffalo.utils").tab_is_valid local merge_tables = require("buffalo.utils").merge_tables -- local M = {} @@ -60,27 +59,6 @@ function M.init_buffers() end end -function M.init_tabs() - local tabs = api.get_tabs() - - for idx = 1, #tabs do - local tab_id = tabs[idx] - local tab_name = api.get_tab_number(tab_id) - local tab_wins = api.get_wins() - -- if buffer is listed, then add to contents and marks - if tab_is_valid(tab_id, tab_name) then - table.insert( - M.tab_marks, - { - tab_name = tab_name, - tab_id = tab_id, - tab_wins = tab_wins, - } - ) - end - end -end - function M.setup(config) log.trace("setup(): Setting up...") @@ -138,6 +116,5 @@ end M.setup() M.init_buffers() -M.init_tabs() return M diff --git a/lua/buffalo/ui.lua b/lua/buffalo/ui.lua index 81df532..eded8cc 100644 --- a/lua/buffalo/ui.lua +++ b/lua/buffalo/ui.lua @@ -315,13 +315,17 @@ function M.toggle_tab_menu() if current_tab == current_tab_id then current_tab_line = idx end - local twins = api.get_tab_wins(idx) - local window = #twins > 1 and #twins .. " windows" or #twins .. " window" if current_tab == 0 then return end - contents[idx] = string.format("Tab %s [%s]", current_tab, window) + if current_tab > 0 then + local twins = api.get_tab_wins(idx) + local window = #twins > 1 and "[ " .. #twins .. " windows ]" or "[ " .. #twins .. " window ]" + contents[idx] = string.format("Tab %s %s", current_tab, window) + else + contents[idx] = string.format("Tab [ deleted ]") + end end vim.api.nvim_set_option_value("number", true, { win = Buffalo_Tabs_win_id }) @@ -472,6 +476,9 @@ function M.nav_tab(id, command) if tabid ~= -1 then vim.cmd(tabid .. "tabnext") end + elseif command == "tabclose" then + -- vim.api.nvim_tabpage_del_var(id, "buffalo") + vim.cmd(id .. "tabclose") else vim.cmd(id .. command) end