Add tabs module

This commit is contained in:
2022-01-22 14:28:12 +03:00
parent 718e3e3a06
commit 238ff216d2
2 changed files with 27 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
local M = {
history = {},
}
M.close_tab = function()
table.insert(M.history, vim.fn.bufnr("%"))
vim.cmd("tabclose")
end
M.restore_tab = function()
local buflen = #M.history
if buflen == 0 then
print("No buffers remaining")
return
end
local buf = M.history[buflen]
vim.cmd("tabnew +" .. tostring(buf) .. "buf")
table.remove(M.history, buflen)
end
return M