Implementing "Clock" In Lualine #493
harrisoncramer
started this conversation in
Ideas
Replies: 1 comment 6 replies
-
Lualine itself doesn't trigger any statusline redraw. Instead when if _G.Statusline_timer == nil then
_G.Statusline_timer = vim.loop.new_timer()
else
_G.Statusline_timer:stop()
end
_G.Statusline_timer:start(0, -- never timeout
1000, -- repeat every 1000 ms
vim.schedule_wrap(function() -- updater function
vim.api.nvim_command('redrawstatus')
end)) |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All,
First off, thank you for the amazing plugin. It's exactly what I needed from a status line plugin.
I'm curious, is it possible to implement a function that will update? I'm currently using this Lua expression to get the current time:
os.date("%I:%M:%S", os.time())
However, this only updates when I type (which is odd) How might you implement this so that it's updated every second? Thanks again!
Beta Was this translation helpful? Give feedback.
All reactions