dynamic tab, tabline changes

This commit is contained in:
2022-12-05 05:15:24 -06:00
parent 2358ac3d71
commit 3aca6d02ad
5 changed files with 95 additions and 44 deletions
+24
View File
@@ -0,0 +1,24 @@
local M = {}
-- Whether to switch between buffers or tabs
local function tab_mode()
return vim.fn.tabpagenr("$") > 1
end
-- Whether to show windows or buffers in lualine
local function window_mode()
return vim.fn.winnr("$") > 1 or tab_mode()
end
M.tab_mode = tab_mode
M.window_mode = window_mode
function M.tab()
vim.cmd(tab_mode() and "tabn" or "bnext")
end
function M.shift_tab()
vim.cmd(tab_mode() and "tabp" or "bprevious")
end
return M