Schedule a redraw of tabline when setting tabline (#520)

* Schedule a redraw of tabline when setting tabline

The tabline isn't drawn until scrolling the window or opening another file. Opening multiple files at once (e.g. nvim a.txt b.txt) will only show the first.

By performing a deferred redraw of the tabline this fixes this startup behaviour problem.

* Changed to use vim.schedule
This commit is contained in:
smhc 2022-01-02 21:05:42 +10:00 committed by GitHub
parent c2107f52e1
commit a11f6d15d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -258,6 +258,9 @@ local function set_tabline()
if next(config.tabline) ~= nil then
vim.go.tabline = "%{%v:lua.require'lualine'.tabline()%}"
vim.go.showtabline = 2
vim.schedule(function()
vim.api.nvim_command('redrawtabline')
end)
end
end