Skip to content

Commit

Permalink
feat: add option always_show_tabline to control whether show `tabli…
Browse files Browse the repository at this point in the history
…ne` when there are only one tab. (#1013)

* feat: add option `always_show_tabline`.
---------

Co-authored-by: shadmansaleh <[email protected]>
  • Loading branch information
milanglacier and shadmansaleh authored Nov 1, 2024
1 parent b431d22 commit 2563fa4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ require('lualine').setup {
},
ignore_focus = {},
always_divide_middle = true,
always_show_tabline = true,
globalstatus = false,
refresh = {
statusline = 1000,
Expand Down Expand Up @@ -378,6 +379,10 @@ options = {
-- can't take over the entire statusline even
-- if neither of 'x', 'y' or 'z' are present.

always_show_tabline = true -- When set to true, if you have configured lualine for displaying tabline
-- then tabline will always show. If set to false, then tabline will be displayed
-- only when there are more than 1 tab. (see :h showtabline)

globalstatus = false, -- enable global statusline (have a single statusline
-- at bottom of neovim instead of one for every window).
-- This feature is only available in neovim 0.7 and higher.
Expand Down
2 changes: 1 addition & 1 deletion lua/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ local function set_tabline(hide)
"call v:lua.require'lualine'.refresh({'kind': 'tabpage', 'place': ['tabline'], 'trigger': 'autocmd'})",
'lualine_tal_refresh'
)
modules.nvim_opts.set('showtabline', 2, { global = true })
modules.nvim_opts.set('showtabline', config.options.always_show_tabline and 2 or 1, { global = true })
timers.halt_tal_refresh = false
else
modules.nvim_opts.restore('tabline', { global = true })
Expand Down
1 change: 1 addition & 0 deletions lua/lualine/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local config = {
},
ignore_focus = {},
always_divide_middle = true,
always_show_tabline = true,
globalstatus = vim.go.laststatus == 3,
refresh = {
statusline = 1000,
Expand Down
1 change: 1 addition & 0 deletions tests/spec/lualine_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Lualine', function()
},
ignore_focus = {},
always_divide_middle = true,
always_show_tabline = true,
globalstatus = false,
refresh = {
statusline = 1000,
Expand Down

0 comments on commit 2563fa4

Please sign in to comment.