Skip to content

About

Neovim plugin for tmetric: open the TMetric TUI in a floating window and start or stop timers from the editor

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

tmetric.nvim

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.

Requirements

  • Neovim 0.11 or later.
  • snacks.nvim (LazyVim ships it).
  • tmetric on your PATH, signed in:
brew install othercodes/tap/tmetric
tmetric login

Install

With 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.

Usage

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().

Configuration

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.

Troubleshooting

:checkhealth tmetric checks the Neovim version, the tmetric executable and snacks.nvim.

Development

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.

License

MIT

About

Neovim plugin for tmetric: open the TMetric TUI in a floating window and start or stop timers from the editor

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages