- Lua 97.9%
- Makefile 2.1%
Annotations are persisted extmarks and refresh only fired on BufReadPost, BufWritePost, and FocusGained. Switching away from a buffer, changing its git state out-of-band (commit, checkout, rebase), then switching back left the old ages showing until the next save or focus. Add BufEnter to the refresh triggers. The blame cache from #10 keeps this cheap: entering an unchanged buffer hits the cache (a stat, no git spawn), so only a real git-state change triggers a re-blame. Closes #9 |
||
|---|---|---|
| .github | ||
| assets | ||
| doc | ||
| lua/todoage | ||
| plugin | ||
| tests | ||
| .gitignore | ||
| .stylua.toml | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
todoage.nvim ⏳
Neovim plugin that displays the age of TODO comments as inline virtual text.
Requirements
- Neovim 0.10+ (for
vim.system) gitonPATH- A tree-sitter parser installed for the languages you want annotated (
:TSInstall <lang>)
Installation
{
"harukikuri/todoage.nvim",
}
Usage
:Todoage- refresh the current buffer:TodoageEnable- resume auto-refresh and re-annotate all loaded buffers:TodoageDisable- clear all annotations and pause auto-refresh:TodoageToggle- enable/disable
Configuration
opts = {
-- keywords = { "TODO", "FIXME", "HACK" },
-- format = function(age_days)
-- return string.format("(%d days)", age_days)
-- end,
}
keywords replaces the default list wholesale, not merges. If you want the defaults plus extras, list them all. Each keyword must contain only letters, digits, and underscores — setup() raises an error otherwise.
format receives the age in days and must return a string. It controls only the text; the highlight color is applied separately. Errors in your format function are not caught — fix the function if annotations stop appearing.
Highlights
| Group | Applies to | Default highlight |
|---|---|---|
TodoageAge |
committed age annotation | Comment |
TodoageUncommitted |
not yet in git | Comment |
By default annotations render muted — the age number itself carries the signal. Override TodoageAge to make annotations visually louder. See Customizing colors.
Customizing colors
Colors are not exposed through setup({}) — set the highlight groups directly. This way colorschemes can ship Todoage* definitions that just work.
vim.api.nvim_set_hl(0, "TodoageAge", { fg = "#d7af5f" })
vim.api.nvim_set_hl(0, "TodoageUncommitted", { fg = "#5f5f5f", italic = true })
:colorscheme wipes all highlight groups. To have overrides survive theme switches, wrap them in a ColorScheme autocmd:
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
vim.api.nvim_set_hl(0, "TodoageAge", { fg = "#d7af5f", bold = true })
-- ...other overrides
end,
})
Coexistence with other TODO plugins
Designed to complement todo-comments.nvim and similar plugins. todoage.nvim only adds end-of-line age annotations — it does not highlight the keyword itself, provide a quickfix list, or affect search.
License
MIT
