nanozuki / tabby.nvim

A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
MIT License
563 stars 21 forks source link

unexpected square character between and inside tabs #144

Closed xavier-balesi closed 1 month ago

xavier-balesi commented 1 month ago

From my last update from commit e14a87c to eeeb22a : There is an unexpected separator at the begining of tab et between tabs: image before (this is that I expect): image

my tabby config:

-- Tabby config
local palette = {
    accent = '#B27B4C',     -- orange
    accent_sec = '#D2AC63', -- fg4
    bg = '#312E2B',         -- bg1
    bg_sec = '#4B4541',     -- bg2
    fg = '#B7AFA7',         -- fg2
    fg_sec = '#9A8C7A',     -- fg3
}
local function make_theme()
    return {
        line = 'TabLineFill',
        head = { fg = '#000000', bg = palette.accent, style = 'bold' },
        current_tab = { fg = palette.bg, bg = palette.accent_sec, style = 'bold' },
        tab = { fg = palette.fg, bg = palette.bg_sec },
        current_win = { fg = palette.accent_sec, bg = palette.bg_sec, style = 'bold' },
        win = { fg = palette.fg, bg = palette.bg_sec },
        tail = { fg = palette.bg, bg = palette.accent_sec },
    }
end

local function tabby_config()
    local theme = make_theme()
    vim.opt.showtabline = 2
    require('tabby.tabline').set(function(line)
        local cwd = ' ' .. vim.fn.fnamemodify(vim.fn.getcwd(), ':t') .. ' '
        local branch = vim.b.gitsigns_head or '-'
        return {
            { { cwd, hl = theme.head }, line.sep('', theme.head, theme.line) },
            { line.sep('', theme.head, theme.line), { branch, hl = theme.head }, line.sep('', theme.head, theme.line), margin = ' ', hl = theme.head },
            line.tabs().foreach(function(tab)
                local hl = tab.is_current() and theme.current_tab or theme.tab
                return {
                    line.sep('', hl, theme.line),
                    tab.is_current() and '' or '',
                    tab.number(),
                    tab.name(),
                    line.sep('', hl, theme.line),
                    margin = ' ',
                    hl = hl,
                }
            end),
            line.spacer(),
            line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
                local hl = win.is_current() and theme.current_win or theme.win

                -- exclude some buffers
                local exclude_patterns = { 'NvimTree_' }
                for _, pattern in ipairs(exclude_patterns) do
                    if win.buf_name():find(pattern) then
                        return
                    end
                end

                return {
                    line.sep('', theme.win, theme.line),
                    -- win.is_current() and '' or '',
                    win.buf_name(),
                    { win.buf().is_changed() and '' or '' },
                    line.sep('', theme.win, theme.line),
                    margin = ' ',
                    hl = hl,
                }
            end),
            { line.sep('', theme.tail, theme.line), { '  ', hl = theme.tail } },
            hl = theme.line,
        }
    end, {
        tab_name = { name_fallback = function(tabid) return "New" end },
        buf_name = { mode = 'unique' },
    })
end
local tabby = {
    'nanozuki/tabby.nvim',
    event = 'VimEnter',
    dependencies = "nvim-tree/nvim-web-devicons",
    config = tabby_config,
}
nanozuki commented 1 month ago

Sorry for that; in the last commit, I update the line render for performance. @xavier-balesi I fixed a version at the main branch. Can you check this?

xavier-balesi commented 1 month ago

This is OK now :) image

Thank you !