Ignore the node_modules and .git directory
When I'm trying to list my project todos :TodoLocList, it lists the node_modules todos as well.
And I couldn't stop it doing this.
Me too. Really wish I could remove node_modules from seeing.
I had this issue as well and I found that this solution works https://github.com/folke/todo-comments.nvim/issues/71
I had this issue as well and I found that this solution works #71
Hi!! How did you make it work? I tried but it didn't work.
I got the majority of this config elsewhere but I added the glob line for the search and it worked for me. Looks like it matches the basic recommended config though.
todo_comments.setup({
signs = true,
sign_priority = 8,
keywords = {
FIX = {
icon = " ",
color = "error",
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" },
},
TODO = { icon = " ", color = "info" },
HACK = { icon = " ", color = "warning" },
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
},
merge_keywords = true,
highlight = {
before = "",
keyword = "wide",
after = "fg",
pattern = [[.*<(KEYWORDS)\s*:]],
comments_only = true,
max_line_len = 400,
exclude = {},
},
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarning", "WarningMsg", "#FBBF24" },
info = { "DiagnosticInfo", "#2563EB" },
hint = { "DiagnosticHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--glob=!node_modules",
},
pattern = [[\b(KEYWORDS):]],
},
})
I got the majority of this config elsewhere but I added the glob line for the search and it worked for me. Looks like it matches the basic recommended config though.
todo_comments.setup({ signs = true, sign_priority = 8, keywords = { FIX = { icon = " ", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, }, TODO = { icon = " ", color = "info" }, HACK = { icon = " ", color = "warning" }, WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, }, merge_keywords = true, highlight = { before = "", keyword = "wide", after = "fg", pattern = [[.*<(KEYWORDS)\s*:]], comments_only = true, max_line_len = 400, exclude = {}, }, colors = { error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, warning = { "DiagnosticWarning", "WarningMsg", "#FBBF24" }, info = { "DiagnosticInfo", "#2563EB" }, hint = { "DiagnosticHint", "#10B981" }, default = { "Identifier", "#7C3AED" }, }, search = { command = "rg", args = { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--glob=!node_modules", }, pattern = [[\b(KEYWORDS):]], }, })
Oh man, thank you very much. I haven't payed attention to the glob args and left it as public, just like the other person in the #71 left it. Now it makes sense haha.
Thanks for sharing.