Neovim plugin for tmetric, the unofficial TMetric CLI and TUI: open the TUI in a floating window and start or stop timers without leaving the editor.
- Neovim 0.11 or later.
- snacks.nvim (LazyVim ships it).
tmetricon yourPATH, signed in:
brew install othercodes/tap/tmetric
tmetric loginWith lazy.nvim:
{
"othercodes/tmetric.nvim",
dependencies = { "folke/snacks.nvim" },
lazy = false, -- the plugin loads itself on first use
keys = {
{ "<leader>Tu", "<Plug>(TmetricUi)", desc = "TMetric UI" },
{ "<leader>Ts", "<Plug>(TmetricStart)", desc = "Start timer" },
{ "<leader>Tx", "<Plug>(TmetricStop)", desc = "Stop timer" },
{ "<leader>Ti", "<Plug>(TmetricStatus)", desc = "Timer status" },
},
}The plugin works without setup() and maps no keys: pick your own.
| Command | What it does |
|---|---|
:Tmetric or :Tmetric ui |
Opens tmetric ui in a floating window. Run it again to hide or show it. |
:Tmetric start |
Starts a timer: asks for a description, then a project from your list. |
:Tmetric stop |
Stops the running timer. |
:Tmetric status |
Shows the running timer. |
Starting a timer stops the one that runs, and stopping one ends tracked time, so both ask first.
Each command has a <Plug> mapping: <Plug>(TmetricUi), <Plug>(TmetricStart), <Plug>(TmetricStop) and <Plug>(TmetricStatus). From Lua: require("tmetric").open(), .start(), .stop() and .status().
Optional. These are the defaults:
require("tmetric").setup({
cmd = "tmetric", -- the executable
win = {}, -- window options for Snacks.terminal, e.g. { border = "rounded" }
})With lazy.nvim, put them in opts.
:checkhealth tmetric checks the Neovim version, the tmetric executable and snacks.nvim.
luarocks test --local # installs busted and nlua, then runs the specs
stylua --check .The tests run against a fake tmetric in spec/bin, never against the TMetric API.