feat: add support for function in max_length option (tabs & buffers)
This commit is contained in:
parent
96263bcef6
commit
ecaa491c3c
|
@ -413,6 +413,7 @@ sections = {
|
||||||
show_filename_only = true, -- shows shortened relative path when false
|
show_filename_only = true, -- shows shortened relative path when false
|
||||||
show_modified_status = true -- shows indicator then bufder is modified
|
show_modified_status = true -- shows indicator then bufder is modified
|
||||||
max_length = vim.o.columns * 2 / 3, -- maximum width of buffers component
|
max_length = vim.o.columns * 2 / 3, -- maximum width of buffers component
|
||||||
|
-- can also be a function that returns value of max_length dynamicaly
|
||||||
filetype_names = {
|
filetype_names = {
|
||||||
TelescopePrompt = 'Telescope',
|
TelescopePrompt = 'Telescope',
|
||||||
dashboard = 'Dashboard',
|
dashboard = 'Dashboard',
|
||||||
|
@ -538,6 +539,7 @@ sections = {
|
||||||
{
|
{
|
||||||
'tabs',
|
'tabs',
|
||||||
max_length = vim.o.columns / 3, -- maximum width of tabs component
|
max_length = vim.o.columns / 3, -- maximum width of tabs component
|
||||||
|
-- can also be a function that returns value of max_length dynamicaly
|
||||||
mode = 0, -- 0 shows tab_nr
|
mode = 0, -- 0 shows tab_nr
|
||||||
-- 1 shows tab_name
|
-- 1 shows tab_name
|
||||||
-- 2 shows tab_nr + tab_name
|
-- 2 shows tab_nr + tab_name
|
||||||
|
|
|
@ -93,6 +93,10 @@ function M:update_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
local max_length = self.options.max_length
|
local max_length = self.options.max_length
|
||||||
|
if type(max_length) == 'function' then
|
||||||
|
max_length = max_length(self)
|
||||||
|
end
|
||||||
|
|
||||||
if max_length == 0 then
|
if max_length == 0 then
|
||||||
max_length = math.floor(2 * vim.o.columns / 3)
|
max_length = math.floor(2 * vim.o.columns / 3)
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,6 +76,10 @@ function M:update_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
local max_length = self.options.max_length
|
local max_length = self.options.max_length
|
||||||
|
if type(max_length) == 'function' then
|
||||||
|
max_length = max_length(self)
|
||||||
|
end
|
||||||
|
|
||||||
if max_length == 0 then
|
if max_length == 0 then
|
||||||
max_length = math.floor(vim.o.columns / 3)
|
max_length = math.floor(vim.o.columns / 3)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue