A lightweight, high-performance Neovim plugin for highlighting and managing TODO-style comments with advanced listing capabilities.
- Blazing Fast: < 5ms startup, < 10ms for 1000-line buffers
- Real-time Highlighting: Instant visual feedback as you type
- Smart Navigation: Quickfix list and Telescope integration
- Optimized Performance: Incremental updates and lazy loading
- Highly Configurable: Custom keywords, colors, and patterns
- Low Overhead: < 1MB memory usage for 50 open buffers
- Robust Pattern Matching: Uses Lua string patterns for maximum compatibility
- Priority-based Sorting: Organize TODOs by importance
Using lazy.nvim (Recommended)
{
"gendonholaholo/todo-lens.nvim",
event = { "BufReadPost", "BufNewFile" },
config = function()
require("todo_lens").setup({
keywords = {
TODO = { color = "#ff9e64", priority = 10 },
FIXME = { color = "#e86671", priority = 10 },
HACK = { color = "#bb9af7", priority = 5 },
NOTE = { color = "#7dcfff", priority = 1 },
BUG = { color = "#f7768e", priority = 15 },
PERF = { color = "#9ece6a", priority = 8 },
},
})
-- Optional keymaps
vim.keymap.set("n", "<leader>tl", "<cmd>TodoList<CR>", { desc = "List TODOs" })
vim.keymap.set("n", "<leader>tt", "<cmd>TodoToggle<CR>", { desc = "Toggle TODO highlighting" })
vim.keymap.set("n", "<leader>tf", "<cmd>TodoTelescope<CR>", { desc = "Find TODOs" })
end,
}Using packer.nvim
use({
"gendonholaholo/todo-lens.nvim",
config = function()
require("todo_lens").setup()
end,
})Using vim-plug
Plug 'gendonholaholo/todo-lens.nvim'{
dir = "/path/to/your/todo-lens.nvim",
name = "todo-lens.nvim",
config = function()
require("todo_lens").setup()
end,
}:TodoList- Open quickfix window with all TODO items from open buffers:TodoToggle- Toggle comment highlighting on/off:TodoTelescope- Open fuzzy finder for TODO items (requires telescope.nvim)
No default keymaps are set. Add your preferred mappings:
vim.keymap.set("n", "<leader>tl", "<cmd>TodoList<CR>", { desc = "List TODOs" })
vim.keymap.set("n", "<leader>tt", "<cmd>TodoToggle<CR>", { desc = "Toggle TODO highlighting" })
vim.keymap.set("n", "<leader>tf", "<cmd>TodoTelescope<CR>", { desc = "Find TODOs" })require("todo_lens").setup({
keywords = {
TODO = { color = "TodoHighlightTODO", priority = 10 },
FIXME = { color = "TodoHighlightFIXME", priority = 10 },
HACK = { color = "TodoHighlightHACK", priority = 5 },
NOTE = { color = "TodoHighlightNOTE", priority = 1 },
},
colors = {
TODO = "#ff9e64", -- Orange
FIXME = "#e86671", -- Red
HACK = "#bb9af7", -- Purple
NOTE = "#7dcfff", -- Blue
},
highlight = {
keyword = "fg", -- options: "fg" | "bg" | "none"
after_keyword = "comment", -- highlight group for text after keyword
},
})require("todo_lens").setup({
keywords = {
-- Using hex colors (automatically creates highlight groups)
BUG = { color = "#ff0000", priority = 20 },
PERF = { color = "#ffff00", priority = 15 },
TEST = { color = "#00ff00", priority = 5 },
-- Using existing highlight groups
WARN = { color = "WarningMsg", priority = 12 },
INFO = { color = "Comment", priority = 3 },
},
})The plugin detects TODO comments in various formats:
-- TODO: Basic format
-- FIXME without colon
-- NOTE: with extra spaces
/* HACK: in block comments */
# TODO: in shell comments
<!-- FIXME: in HTML comments -->Requires telescope.nvim:
- Fuzzy search across all TODO items
- Live preview of TODO context
- Quick jump-to-definition
- Priority-based sorting
Standard Neovim quickfix list with:
- File path and location
- Keyword type and description
- Priority-based sorting
- Standard navigation (
<Enter>to jump)
Optional integration with which-key.nvim:
-- Create separate file: lua/plugins/todo-lens-which-key.lua
return {
{
"folke/which-key.nvim",
optional = true,
opts = function(_, opts)
if not opts.spec then
opts.spec = {}
end
table.insert(opts.spec, {
{ "<leader>t", group = "TODO", icon = "" },
{ "<leader>tl", desc = "List TODOs", icon = "" },
{ "<leader>tt", desc = "Toggle TODO highlighting", icon = "" },
{ "<leader>tf", desc = "Find TODOs", icon = "" },
})
return opts
end,
},
}The plugin is optimized for performance:
- Fast Startup: Lazy loading with event-based initialization
- Efficient Parsing: Lua string patterns instead of complex regex
- Incremental Updates: Only processes changed content
- Memory Conscious: Minimal memory footprint
- Debounced Processing: Prevents excessive updates during rapid typing
- Check
:Lazystatus (if using lazy.nvim) - Verify plugin path in configuration
- Restart Neovim:
:Lazy reload todo-lens.nvim
- Check if highlighting is enabled:
:TodoToggle - Verify TODO comments exist in current buffer
- Check error messages:
:messages
- Verify plugin setup:
:lua print(vim.inspect(require("todo_lens"))) - Check for configuration errors
- Ensure plugin loaded properly
The plugin works without which-key. If you see warnings:
- Remove which-key integration from plugin config
- Use separate which-key configuration file (see above)
- Check
:checkhealth which-key
# Install dependencies
make install
# Run tests
make test
# Format code
make format
# Check formatting
make lint
# Run all CI tasks
make ci├── lua/
│ ├── todo_highlight/ # Main plugin modules
│ │ ├── init.lua # Plugin entry point
│ │ ├── config.lua # Configuration management
│ │ ├── parser.lua # TODO parsing logic
│ │ ├── highlighter.lua # Highlighting functionality
│ │ ├── quickfix.lua # Quickfix integration
│ │ └── telescope.lua # Telescope integration
│ └── todo_lens/
│ └── init.lua # Alias for backward compatibility
├── plugin/ # Vim plugin files
├── tests/ # Test suite
├── doc/ # Documentation
└── .github/workflows/ # CI/CD
- Neovim >= 0.7.0
- Optional: telescope.nvim for fuzzy finding
- Optional: which-key.nvim for key descriptions
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
make cito ensure all checks pass - Submit a pull request
MIT License. See LICENSE for details.
- Inspired by various TODO highlighting solutions in the Neovim ecosystem
- Built with Neovim's powerful Lua API
- Thanks to all contributors and testers
Ready to try it out? Clone the repository and follow the installation instructions above!