lualine.nvim
lualine.nvim copied to clipboard
Feat: Delay updating lualine to prevent flickering
Requested feature
Allow "delaying" an update to prevent flicker when rapidly changing modes:
https://github.com/nvim-lualine/lualine.nvim/assets/300146/f4089705-46c7-4523-a82a-73598641cde7
Motivation
User has a hotkey:
map('n', '<Tab>', ':call NextFile()<cr>', remap_silent('Next buff|tab'))
It works as expected, however when executing the command, lualine briefly flickers from Normal to Command and then back to Normal.
It is "as expected" behaviour, but nevertheless annoying.
:help <cmd> Should be used to prevent this from happening,
Also the fzfx issue isn't about mapping/mode changes, If you open a tabpage with lualine the whole statusline disappears sometimes. I think this is because lualine doesn't load the window's statusline in the time a tabpage opens. Try refreshing it when the tab is opened.
vim.api.nvim_create_autocmd("TabNewEntered",{
pattern = "*",
callback = function(opts)
require('lualine').refresh()
end,
})
This should fix the flicker, However adding this to lualine is gonna be difficult/ugly, Because in lualine the autocmd updates are scheduled via vim.schedule,But this one needs to be refreshed right away.
@Sam-programs,
:help
Should be used to prevent this from happening,
What do you mean?
Use <cmd> instead of : to stop the flickering in the mapping.
:help <cmd> :
The <Cmd> pseudokey begins a "command mapping", which executes the command
directly without changing modes. Where you might use ":...<CR>" in the
{rhs} of a mapping, you can instead use "<Cmd>...<CR>".
Since it doesn't change modes lualine doesn't flicker.