Skip to content

Commit a18bf32

Browse files
committed
fix(nvim): todo highlighting for todos with parentheses
from folke/todo-comments.nvim#255
1 parent 7bb4d09 commit a18bf32

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

home/nvim/nvim/lua/plugins/ui/init.lua

+20-18
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ return {
2323
},
2424

2525
-- TODO: This is a todo
26-
2726
-- TODO(scope): This is a todo
28-
2927
-- TODO (scope): This is a todo
30-
31-
-- TODO(): This is a todo
28+
-- WARN(tomg): This is a warning
29+
-- FIXME: This is a fixme
30+
-- todo: This is a lowercase todo
3231

3332
{ -- Highlight todo, notes, etc in comments
3433
"folke/todo-comments.nvim",
@@ -37,30 +36,33 @@ return {
3736
dependencies = { "nvim-lua/plenary.nvim" },
3837
opts = {
3938
signs = false,
40-
-- highlight = {
41-
-- pattern = [[\<(KEYWORDS)\s\?(\([-\s[:alnum:]_]*\))\?:]], -- FIXME: Not working; getting E55 unmatch \) when run in cmd mode
42-
-- },
39+
-- TODO: make case-insensitive, `\c` flag doesn't seem to work below
40+
highlight = {
41+
-- vimgrep regex, supporting the pattern TODO(name):
42+
pattern = [[.*<((KEYWORDS)\s*%(\(.{-1,}\))?):\c]],
43+
},
4344
search = {
44-
-- args = {
45-
-- "--color=never",
46-
-- "--no-heading",
47-
-- "--with-filename",
48-
-- "--line-number",
49-
-- "--column",
50-
-- "--ignore-case", -- FIXME: doesn't work
51-
-- },
52-
pattern = [[\b(KEYWORDS)\s*?(\([-\s[:alnum:]_]+\))?:]],
45+
command = "rg",
46+
args = {
47+
"--color=never",
48+
"--no-heading",
49+
"--with-filename",
50+
"--line-number",
51+
"--column",
52+
"--ignore-case",
53+
},
54+
-- ripgrep regex, supporting the pattern TODO(name):
55+
pattern = [[\b(KEYWORDS)(\(\w*\))*:]],
5356
},
5457
},
5558
config = function(_, opts)
5659
local todo_comments = require("todo-comments")
60+
todo_comments.setup(opts)
5761

5862
-- stylua: ignore start
5963
vim.keymap.set("n", "]t", function() todo_comments.jump_next() end, { desc = "Next [T]odo comment" })
6064
vim.keymap.set("n", "[t", function() todo_comments.jump_prev() end, { desc = "Prev [T]odo comment" })
6165
-- stylua: ignore end
62-
63-
todo_comments.setup(opts)
6466
end,
6567
},
6668

0 commit comments

Comments
 (0)