Files
dotfiles/config/nvim/lua/user/tabs.lua
2022-01-22 14:28:12 +03:00

25 lines
387 B
Lua

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