Closed nyngwang closed 1 year ago
Can you show me your config?
@nanozuki
use {
'nanozuki/tabby.nvim',
config = function ()
local theme = {
fill = 'TabLine',
head = 'TabLine',
current_tab = 'TabLineSel',
tab = 'TabLine',
win = 'TabLineSel',
tail = 'TabLine',
}
require('tabby.tabline').set(function(line)
return {
{
{ ' ', hl = theme.head },
},
line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
if not vim.api.nvim_buf_get_option(win.buf().id, 'buflisted') then return {} end
local hl = win.is_current() and theme.win or theme.fill
local rhl = win.is_current() and theme.fill or theme.win
return {
line.sep(win.is_current() and '' or '', hl, rhl),
win.is_current() and ' ' or '',
win.buf_name(),
line.sep(win.is_current() and '' or '', hl, rhl),
line.sep(' ', theme.fill, theme.fill),
hl = hl,
margin = '',
}
end),
line.spacer(),
line.tabs().foreach(function(tab)
local hl = tab.is_current() and theme.current_tab or theme.tab
local rhl = tab.is_current() and theme.tab or theme.current_tab
return {
line.sep(tab.is_current() and ' ' or '', hl, rhl),
tab.number(),
line.sep(tab.is_current() and ' ' or '', hl, rhl),
line.sep(' ', theme.fill, theme.fill),
hl = hl, margin = '',
}
end),
{
line.sep(' ', theme.tail, theme.tail),
line.sep(' ', theme.tail, theme.tail),
},
hl = theme.fill,
}
end)
end
}
Sorry for late, I've been a little busy in my daily life lately.
the problem is, the label's width of current win and non-current win is not equal. One is 1
, another one is 2
. So, then the current window changed, the label's position is changed.
Maybe you can change config to:
line.sep(win.is_current() and '' or ' ', hl, rhl),
DEMO
https://user-images.githubusercontent.com/24765272/204909458-341235b7-e6af-4207-9f38-ff0684aa918c.mov
Description
Notice that when I toggled between tabs 1 and 2, the position of
1
and2
changed. I think the culprit is that when the length of the current buffername changed, thespacer
seems to still add the same number of spaces. In the demo, since the buffernameplugins.lua
is longer than[No Name]
, both1
and2
were pushed more to the right.