From 29b1a4167b872c0babe12150ade2f9bb1bf1e1c8 Mon Sep 17 00:00:00 2001 From: Milan Glacier Date: Sun, 9 Apr 2023 17:23:13 -0400 Subject: [PATCH 1/2] feat: add option `always_show_tabs`. --- README.md | 5 +++++ lua/lualine.lua | 2 +- lua/lualine/config.lua | 1 + tests/spec/lualine_spec.lua | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d988d5ac..0b7ace83a 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ require('lualine').setup { }, ignore_focus = {}, always_divide_middle = true, + always_show_tabs = true, globalstatus = false, refresh = { statusline = 1000, @@ -366,6 +367,10 @@ options = { -- can't take over the entire statusline even -- if neither of 'x', 'y' or 'z' are present. + always_show_tabs = 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. diff --git a/lua/lualine.lua b/lua/lualine.lua index 49e38a124..584c4e567 100644 --- a/lua/lualine.lua +++ b/lua/lualine.lua @@ -482,7 +482,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_tabs and 2 or 1, { global = true }) timers.halt_tal_refresh = false else modules.nvim_opts.restore('tabline', { global = true }) diff --git a/lua/lualine/config.lua b/lua/lualine/config.lua index 5ee6e042b..8e15378f8 100644 --- a/lua/lualine/config.lua +++ b/lua/lualine/config.lua @@ -18,6 +18,7 @@ local config = { }, ignore_focus = {}, always_divide_middle = true, + always_show_tabs = true, globalstatus = vim.go.laststatus == 3, refresh = { statusline = 1000, diff --git a/tests/spec/lualine_spec.lua b/tests/spec/lualine_spec.lua index 47854ead8..cb14f7b28 100644 --- a/tests/spec/lualine_spec.lua +++ b/tests/spec/lualine_spec.lua @@ -21,6 +21,7 @@ describe('Lualine', function() }, ignore_focus = {}, always_divide_middle = true, + always_show_tabs = true, globalstatus = false, refresh = { statusline = 1000, From ab2d5fd5f0584ce252038891a8724de96967a742 Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:00:08 +0600 Subject: [PATCH 2/2] refactor: rename opt always_show_tabs to always_show_tabline --- README.md | 4 ++-- lua/lualine.lua | 2 +- lua/lualine/config.lua | 2 +- tests/spec/lualine_spec.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b7ace83a..43ac03b15 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ require('lualine').setup { }, ignore_focus = {}, always_divide_middle = true, - always_show_tabs = true, + always_show_tabline = true, globalstatus = false, refresh = { statusline = 1000, @@ -367,7 +367,7 @@ options = { -- can't take over the entire statusline even -- if neither of 'x', 'y' or 'z' are present. - always_show_tabs = true -- When set to true, if you have configured lualine for displaying tabline + 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) diff --git a/lua/lualine.lua b/lua/lualine.lua index 584c4e567..ba942fa9b 100644 --- a/lua/lualine.lua +++ b/lua/lualine.lua @@ -482,7 +482,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', config.options.always_show_tabs and 2 or 1, { 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 }) diff --git a/lua/lualine/config.lua b/lua/lualine/config.lua index 8e15378f8..4aec9d600 100644 --- a/lua/lualine/config.lua +++ b/lua/lualine/config.lua @@ -18,7 +18,7 @@ local config = { }, ignore_focus = {}, always_divide_middle = true, - always_show_tabs = true, + always_show_tabline = true, globalstatus = vim.go.laststatus == 3, refresh = { statusline = 1000, diff --git a/tests/spec/lualine_spec.lua b/tests/spec/lualine_spec.lua index cb14f7b28..ade1fb63a 100644 --- a/tests/spec/lualine_spec.lua +++ b/tests/spec/lualine_spec.lua @@ -21,7 +21,7 @@ describe('Lualine', function() }, ignore_focus = {}, always_divide_middle = true, - always_show_tabs = true, + always_show_tabline = true, globalstatus = false, refresh = { statusline = 1000,