No description
  • Lua 97.9%
  • Makefile 2.1%
Find a file
Haruki Kuriwada daffe14d76
Some checks failed
tests / format (push) Has been cancelled
tests / test (nightly) (push) Has been cancelled
tests / test (stable) (push) Has been cancelled
fix: refresh annotations on BufEnter (#12)
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
2026-06-03 19:50:11 +09:00
.github chore: update GitHub username to harukikuri 2026-05-29 13:16:14 +08:00
assets docs: highlight the age annotation in demo screenshot 2026-05-25 23:08:46 +09:00
doc fix: re-annotate all loaded buffers on enable (#7) 2026-06-01 18:06:01 +08:00
lua/todoage fix: refresh annotations on BufEnter (#12) 2026-06-03 19:50:11 +09:00
plugin feat: add enable/disable/toggle commands 2026-05-24 00:38:22 +09:00
tests fix: refresh annotations on BufEnter (#12) 2026-06-03 19:50:11 +09:00
.gitignore chore: gitignore .DS_Store 2026-05-25 22:25:03 +09:00
.stylua.toml chore: add stylua config and fmt/fmt-check make targets 2026-05-25 23:17:46 +09:00
CONTRIBUTING.md chore: update GitHub username to harukikuri 2026-05-29 13:16:14 +08:00
LICENSE chore: update GitHub username to harukikuri 2026-05-29 13:16:14 +08:00
Makefile chore: add stylua config and fmt/fmt-check make targets 2026-05-25 23:17:46 +09:00
README.md fix: re-annotate all loaded buffers on enable (#7) 2026-06-01 18:06:01 +08:00

todoage.nvim

Neovim plugin that displays the age of TODO comments as inline virtual text.

demo

Requirements

  • Neovim 0.10+ (for vim.system)
  • git on PATH
  • 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