/time-tracker.nvim

Automatic project / file time tracker for Neovim.

Primary LanguageLua

time-tracker.nvim

image

This is a Neovim plugin that tracks the time you spend working on your projects. It will index your projects based on the current working directory, and track the time spent on each file within the project.

Features

  • Automatically tracks time spent on each project and file
  • Displays project stats for the current session and all-time totals
  • Displays all-time totals for all the tracked projects
  • Small and easy to customize

Setup & requirements

The data is stored in a SQLite database, you need to have sqlite3 in your PATH.

Install (Lazy):

{
    "3rd/time-tracker.nvim",
    dependencies = {
        "3rd/sqlite.nvim",
    },
    event = "VeryLazy",
    opts = {
        data_file = vim.fn.stdpath("data") .. "/time-tracker.db",
        storage = "sqlite",
    },
}

You need to call the setup function, optionally passing a configuration object (defaults below):

require("time-tracker").setup({
  data_file = vim.fn.stdpath("data") .. "/time-tracker.db",
  storage = "sqlite",
  tracking_events = { "BufEnter", "BufWinEnter", "CursorMoved", "CursorMovedI", "WinScrolled" },
  tracking_timeout_seconds = 5 * 60, -- 5 minutes
})

Usage

time-tracker.nvim automatically starts tracking time when you open Neovim and switch between projects or files.

  • :TimeTracker - Opens a pretty window that shows your stats.

In the stats window, you can use the following key mappings:

  • q: Close the time tracking window
  • c: Show statistics for the current project
  • a: Show statistics for all projects

Development

git clone --recurse-submodules https://github.com/3rd/time-tracker.nvim
cd time-tracker.nvim
make # you'll see all the available commands