A lightweight Neovim plugin for starting and stopping Clockwork time-tracking timers directly from inside Git branches.
It automatically extracts issue keys from your branch name (e.g., COMPANY-1234, COMPANY1234, or any custom prefix) and sends start/stop timer requests to the Clockwork API.
Perfect for “start timer for whatever branch I’m on right now”—without switching tools.
- ✅ Start/stop timers with one keypress
- ✅ Automatically extracts issue keys from branch names
- ✅ Supports custom prefixes via
TICKET_PREFIXenv var - ✅ Handles missing tokens and invalid requests gracefully
- ✅ Works with both:
COMPANY-1234COMPANY1234
- ✅ Includes Which-Key group & mappings
- ✅ Written in pure Lua, no setup function required
{
"davec504/clockwork.nvim",
dependencies = { "nvim-lua/plenary.nvim", "folke/which-key.nvim" },
config = function()
require("clockwork_timer")
end,
}Your API token from Clockwork.
export CLOCKWORK_TOKEN="your_api_token"Default: COMPANY
export TICKET_PREFIX="ABC"Matches:
ABC-123ABC123
<M-cg>— Start using current branch<leader>cg— Start (Which-Key)
<M-cs>— Stop<leader>cs— Stop (Which-Key)
Start:
:ClockworkStart
Start with explicit issue key:
:ClockworkStart ABC-123
Stop:
:ClockworkStop
Stop with explicit issue key:
:ClockworkStop ABC-123
Works on branches like:
COMPANY-1234/featureCOMPANY1234-authABC-9999ABC9999
Pattern is generated from $TICKET_PREFIX dynamically.
- Token missing – plugin shows an error on load
- 422 response – “invalid key” warning
- No match in branch – usage hint
- Git command fails – warning, no crash
Ensure Which-Key is loaded before Clockwork.
Check your branch name and TICKET_PREFIX:
echo $TICKET_PREFIX
git branch --show-currentVerify:
echo $CLOCKWORK_TOKENEnsure plenary.nvim is installed.
| Branch Name | Extracted Key |
|---|---|
COMPANY-1234/auth |
COMPANY-1234 |
COMPANY1234-auth |
COMPANY1234 |
ABC-99/new-ui |
ABC-99 |
ABC99/card-fix |
ABC99 |