From 5e96b3d6aa9a5ff9cf2c48ac94d854b290e6340c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 10 Sep 2025 21:05:29 +0800 Subject: [PATCH] nvim/todo-comments: better highlighting regex rule --- .config/nvim/plugin/todo-comments.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.config/nvim/plugin/todo-comments.lua b/.config/nvim/plugin/todo-comments.lua index 9401abd4..c1a19037 100644 --- a/.config/nvim/plugin/todo-comments.lua +++ b/.config/nvim/plugin/todo-comments.lua @@ -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