Note: This plugin is only for a very specific use case: calculating daily and grand totals in markdown tables with punch in/out times in the HH:MM format. Not recommended for other formats.
Your markdown table must look like this:
| Date | In | Out | In | Out | Total |
|---|---|---|---|---|---|
| 2025-01-01 | 10:14 | 13:31 | 14:10 | 16:00 | 05:07 |
| 2025-01-02 | 10:14 | 13:31 | 14:10 | 16:00 | 05:07 |
| ... | ... | ... | ... | ... | ..... |
| GrandTotal | - | - | - | - | 10:14 |
- Time values: Must be in
HH:MMformat. - Empty cells: Use placeholders like
-.
Using packer.nvim:
use 'Ask-786/time-calculator.nvim'- Open your markdown file with the table.
- Press
<leader>tm(default mapping) to calculate and update totals.
Custom mapping:
require('time-calculator').setup({
keymap = '<leader>calc', -- your custom keymap
mode = 'n', -- mode for the mapping
desc = 'Calculate table time',
})Or you can set keymap to nil to disable the mapping completely.
Programmatic use:
require('time-calculator').calculate_time()Use it to e.g. set a custom keybinding with which-key.nvim or lazy.nvim.
Use this plugin only for its intended purpose!