feat(lualine): add quicker refreshing for macro updates
This commit is contained in:
parent
54fd81779a
commit
3654b082bc
1 changed files with 29 additions and 0 deletions
|
@ -102,6 +102,35 @@ return {
|
||||||
},
|
},
|
||||||
extensions = { 'quickfix', 'fugitive', 'nvim-tree' },
|
extensions = { 'quickfix', 'fugitive', 'nvim-tree' },
|
||||||
}, user_config.plugins.lualine or {}))
|
}, user_config.plugins.lualine or {}))
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('RecordingEnter', {
|
||||||
|
callback = function()
|
||||||
|
require('lualine').refresh({
|
||||||
|
place = { 'statusline' },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('RecordingLeave', {
|
||||||
|
callback = function()
|
||||||
|
-- This is going to seem really weird!
|
||||||
|
-- Instead of just calling refresh we need to wait a moment because of the nature of
|
||||||
|
-- `vim.fn.reg_recording`. If we tell lualine to refresh right now it actually will
|
||||||
|
-- still show a recording occuring because `vim.fn.reg_recording` hasn't emptied yet.
|
||||||
|
-- So what we need to do is wait a tiny amount of time (in this instance 50 ms) to
|
||||||
|
-- ensure `vim.fn.reg_recording` is purged before asking lualine to refresh.
|
||||||
|
local timer = vim.loop.new_timer()
|
||||||
|
timer:start(
|
||||||
|
50,
|
||||||
|
0,
|
||||||
|
vim.schedule_wrap(function()
|
||||||
|
require('lualine').refresh({
|
||||||
|
place = { 'statusline' },
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'lualine'),
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'lualine'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue