A Neovim plugin that highlights important keywords in your code based on their severity level. Never miss a FIXME or TODO again!
- 🎯 Smart Highlighting: Automatically highlights keywords based on severity levels
- 🎨 Customizable Colors: Define your own highlight groups and colors
- ⚡ Real-time Updates: Highlights update as you type
- 🔧 Runtime Configuration: Add/remove keywords without restarting
- 📁 Filetype Filtering: Apply highlighting only to specific file types
- 💪 Case Sensitivity: Toggle case-sensitive matching
- 🌈 Theme Compatible: Works with any colorscheme
vim.pack.add("https://github.com/ctfrancia/severityhl.nvim")Using lazy.nvim
{
"ctfrancia/severityhl.nvim",
config = function()
require("severityhl").setup()
end
}Using packer.nvim
use {
"ctfrancia/severityhl.nvim",
config = function()
require("severityhl").setup()
end
}Using vim-plug
Plug 'ctfrancia/severityhl.nvim'
" Add to your init.vim or init.lua
lua require("severityhl").setup()vim.pack.add({
"https://github.com/ctfrancia/severityhl.nvim",
})
require("severityhl").setup()
# Create plugin directory
mkdir -p ~/.config/nvim/pack/plugins/start/severityhl.nvim
# Clone the repository
git clone https://github.com/ctfrancia/severityhl.nvim ~/.config/nvim/pack/plugins/start/severityhl.nvimrequire("severityhl").setup()require("severityhl").setup({
keywords = {
-- High severity (red background)
high = {
words = { "FIXME", "BUG", "ERROR", "HACK", "XXX" },
highlight = "SeverityHigh"
},
-- Medium severity (yellow background)
medium = {
words = { "TODO", "WARNING", "WARN", "DEPRECATED" },
highlight = "SeverityMedium"
},
-- Low severity (blue background)
low = {
words = { "NOTE", "INFO", "OPTIMIZE", "REVIEW" },
highlight = "SeverityLow"
}
},
-- Apply to all file types (empty table means all)
filetypes = {},
-- Case insensitive by default
case_sensitive = false
})Custom Colors:
require("severityhl").setup({
keywords = {
critical = {
words = { "CRITICAL", "URGENT" },
highlight = "MyCritical"
}
}
})
-- Define custom highlight
vim.api.nvim_set_hl(0, "MyCritical", {
fg = "#ffffff",
bg = "#ff0000",
bold = true,
italic = true
})Filetype Specific:
require("severityhl").setup({
-- Only highlight in these file types
filetypes = { "lua", "python", "javascript", "typescript" },
case_sensitive = true
})Minimal Setup:
require("severityhl").setup({
keywords = {
urgent = {
words = { "FIXME", "TODO" },
highlight = "SeverityHigh"
}
}
})| Command | Description |
|---|---|
:SeverityHighlighterRefresh |
Manually refresh highlighting |
:SeverityHighlighterToggleCase |
Toggle case sensitivity |
:SeverityHighlighterAdd <severity> <word> |
Add a keyword to a severity level |
:SeverityHighlighterRemove <severity> <word> |
Remove a keyword from a severity level |
local severity = require("severityhl")
-- Add new keywords
severity.add_keyword("high", "URGENT")
severity.add_keyword("medium", "REFACTOR")
-- Remove keywords
severity.remove_keyword("low", "NOTE")
-- Toggle case sensitivity
severity.toggle_case_sensitive()
-- Refresh highlighting
severity.refresh()The plugin will automatically highlight these patterns:
-- High severity (red)
-- FIXME: This needs immediate attention
-- BUG: Critical issue here
-- ERROR: Something is broken
-- HACK: Temporary solution
-- XXX: Dangerous code
-- Medium severity (yellow)
-- TODO: Implement this feature
-- WARNING: Potential issue
-- DEPRECATED: Use new API instead
-- Low severity (blue)
-- NOTE: Important information
-- INFO: Additional context
-- OPTIMIZE: Performance improvement neededThe plugin comes with sensible defaults that work with most colorschemes:
- High Severity: Bright red text on dark red background
- Medium Severity: Orange text on dark orange background
- Low Severity: Blue text on dark blue background
All highlights include bold formatting for better visibility.
require("severityhl").setup({
keywords = {
-- Keep existing levels
high = {
words = { "FIXME", "BUG" },
highlight = "SeverityHigh"
},
-- Add custom level
security = {
words = { "SECURITY", "VULN", "XSS" },
highlight = "SecurityIssue"
}
}
})
-- Define custom highlight
vim.api.nvim_set_hl(0, "SecurityIssue", {
fg = "#ff6b6b",
bg = "#4a1c1c",
bold = true
})-- Different configurations for different languages
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
callback = function()
require("severityhl").add_keyword("high", "# FIXME")
require("severityhl").add_keyword("medium", "# TODO")
end
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "javascript",
callback = function()
require("severityhl").add_keyword("high", "// FIXME")
require("severityhl").add_keyword("medium", "// TODO")
end
})Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by various TODO highlighting plugins
- Built for the Neovim community
Happy coding! 🎉