todo-comments.lua 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. return {
  2. "folke/todo-comments.nvim",
  3. dependencies = { "nvim-lua/plenary.nvim" },
  4. opts = {
  5. {
  6. signs = true, -- show icons in the signs column
  7. sign_priority = 8, -- sign priority
  8. -- keywords recognized as todo comments
  9. keywords = {
  10. FIX = {
  11. icon = " ", -- icon used for the sign, and in search results
  12. color = "error", -- can be a hex color, or a named color (see below)
  13. alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
  14. -- signs = false, -- configure signs for some keywords individually
  15. },
  16. TODO = { icon = " ", color = "info" },
  17. HACK = { icon = " ", color = "warning" },
  18. WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
  19. PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
  20. NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
  21. TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
  22. },
  23. gui_style = {
  24. fg = "NONE", -- The gui style to use for the fg highlight group.
  25. bg = "BOLD", -- The gui style to use for the bg highlight group.
  26. },
  27. merge_keywords = true, -- when true, custom keywords will be merged with the defaults
  28. -- highlighting of the line containing the todo comment
  29. -- * before: highlights before the keyword (typically comment characters)
  30. -- * keyword: highlights of the keyword
  31. -- * after: highlights after the keyword (todo text)
  32. highlight = {
  33. multiline = true, -- enable multine todo comments
  34. multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
  35. multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
  36. before = "", -- "fg" or "bg" or empty
  37. keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
  38. after = "fg", -- "fg" or "bg" or empty
  39. pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
  40. comments_only = true, -- uses treesitter to match keywords in comments only
  41. max_line_len = 400, -- ignore lines longer than this
  42. exclude = {}, -- list of file types to exclude highlighting
  43. },
  44. -- list of named colors where we try to extract the guifg from the
  45. -- list of highlight groups or use the hex color if hl not found as a fallback
  46. colors = {
  47. error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
  48. warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
  49. info = { "DiagnosticInfo", "#2563EB" },
  50. hint = { "DiagnosticHint", "#10B981" },
  51. default = { "Identifier", "#7C3AED" },
  52. test = { "Identifier", "#FF00FF" }
  53. },
  54. search = {
  55. command = "rg",
  56. args = {
  57. "--color=never",
  58. "--no-heading",
  59. "--with-filename",
  60. "--line-number",
  61. "--column",
  62. },
  63. -- regex that will be used to match keywords.
  64. -- don't replace the (KEYWORDS) placeholder
  65. pattern = [[\b(KEYWORDS):]], -- ripgrep regex
  66. -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
  67. },
  68. }
  69. }
  70. }