nvzone / timerly

Beautiful countdown timer plugin for Neovim
GNU General Public License v3.0
50 stars 0 forks source link

Recipe for Lualine #2

Closed dpetka2001 closed 1 hour ago

dpetka2001 commented 2 hours ago

Hi, really like this one. Here's a recipe for people who want to show the status of the timer in Lualine

local function get_timerly_status()
  local state = require("timerly.state")
  if state.progress == 0 then
    return ""
  end

  local total = math.max(0, state.total_secs + 1) -- Add 1 to sync with timer display
  local mins = math.floor(total / 60)
  local secs = total % 60

  return string.format("%s %02d:%02d", state.mode:gsub("^%l", string.upper), mins, secs)
end

table.insert(opts.sections.lualine_x, get_timerly_status)

Maybe you would like to use that in the README or not. It's up to you. I didn't see a Discussions or Wiki where I could post this, hence I'm posting as an issue even though it's not really one.

Thank you for your hard work :smile:

siduck commented 1 hour ago

nice! i enabled discussions page.