nvim/todo-comments: better highlighting regex rule

This commit is contained in:
Primrose 2025-09-10 21:05:29 +08:00
parent 5bb06fbae6
commit 5e96b3d6aa
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -1,3 +1,9 @@
local highlightPat = [[.*<(KEYWORDS)\s*:]]
local highlightPatMe = [[.*<(KEYWORDS)\(leana8959\):]]
local searchPat = [[\b(KEYWORDS):]]
local searchPatMe = [[\b(KEYWORDS)\(leana8959\):]]
require("todo-comments").setup {
keywords = {
FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
@ -14,6 +20,24 @@ require("todo-comments").setup {
info = { "#696c77" },
hint = { "#696c77" },
},
highlight = {
pattern = { highlightPat, highlightPatMe },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--hidden", -- search hidden files
-- ignore git
"--glob",
"!**/.git/*",
},
pattern = searchPat .. "|" .. searchPatMe,
},
}
-- Todo-Comments