A lightweight and customizable Neovim plugin that highlights todo tags in comments.
- Customizable Todo Tags: Define your own todo keywords and highlight groups
- Smart Highlighting: Only highlights tags in comment regions (treesitter + syntax fallback)
- Partial Highlighting: Match a broader pattern but only highlight a portion (e.g., match
todo:but highlighttodo) - Case Sensitivity: Control whether tags are case-sensitive
- Performance: Efficiently highlights only visible regions with throttling
-- lazy.nvim
{
"fau818/todotag.nvim",
dependencies = "folke/todo-comments.nvim", -- Optional
opts = {},
}The plugin starts automatically after setup(). You can also control it manually:
:TodotagStart " Start highlighting todo tags
:TodotagStop " Stop highlighting todo tagsFull configuration example with all options:
require("todotag").setup({
-- Keywords recognized as todo tags
keywords = {
{ pattern = "todo:", hl_part = "todo", hl_group = "Todo", case_sensitive = false },
{ pattern = "[todo]", hl_part = "todo", hl_group = "Todo", case_sensitive = false },
{ pattern = "fix", hl_group = "Error", case_sensitive = true },
{ pattern = "note:", hl_part = "note", hl_group = "DiagnosticInfo", case_sensitive = false },
},
-- Highlight priority (default: 501, covers todo-comments.nvim)
priority = 501,
-- Throttle updates (in ms, default: 250)
throttle = 250,
-- Only highlight in visible area (default: true)
only_visible = true,
-- Exclude these filetypes
exclude_ft = { "help", "netrw", "tutor" },
-- Exclude these buftypes
exclude_bt = { "nofile", "prompt" },
})| Field | Type | Description |
|---|---|---|
pattern |
string |
Required. The string to match in comments. |
hl_group |
string |
Required. Highlight group to apply. |
hl_part |
string? |
Substring of pattern to highlight. If omitted, the entire match is highlighted. |
case_sensitive |
boolean? |
Default false. When false, matches regardless of case. |
return {
"fau818/todotag.nvim",
opts = {
keywords = {
{ pattern = "todo:", hl_part = "todo", hl_group = "TodoTag", case_sensitive = false },
{ pattern = "note:", hl_part = "note", hl_group = "InfoTag", case_sensitive = false },
{ pattern = "fix", hl_group = "FixTag", case_sensitive = false },
},
},
config = function(_, opts)
-- Define custom highlight groups with literal colors
vim.api.nvim_set_hl(0, "TodoTag", { fg = "#39CC8F", bold = true, italic = true })
vim.api.nvim_set_hl(0, "InfoTag", { fg = "#7AA2F7", bold = true, italic = true })
vim.api.nvim_set_hl(0, "FixTag", { fg = "#C53B53", bold = true, italic = true })
require("todotag").setup(opts)
end,
}- Ensure the tag is inside a comment
- Check that the filetype is not excluded
- Verify the buftype is not excluded
- Make sure the plugin is started with
:TodotagStart
- Increase
throttleto reduce update frequency - Set
only_visible = trueto only highlight visible lines - Reduce the number of keywords
MIT License - see LICENSE file for details
If you have any questions or issues, please open an issue on the GitHub repository: issues
- Inspired by various todo highlighting plugins
- Uses ideas from folke/todo-comments.nvim

