todo-comments.nvim icon indicating copy to clipboard operation
todo-comments.nvim copied to clipboard

feature: Allow multiple highlight colors (expand #255)

Open aarondill opened this issue 1 year ago • 11 comments

Did you check the docs?

  • [X] I have read all the todo-comments.nvim docs

Is your feature request related to a problem? Please describe.

I'd like to highlight the user portion of todo comments in a different color. For example, in the below, FIXME would be one color, (folke) would be a different, and : something is broken would remain unhighlighted.

--- FIXME(folke): something is broken

Describe the solution you'd like

Accept a list for the color argument. Color each capture group in the regex after the first with it's corresponding color. For example, the below would accomplish the above highlighting.

{
    keywords = {
      FIXME = {  color = {"error", "user"} }
    },
    colors = {
      error = { fg = "#ff0000" },
      user = { fg = "#ffa500" },
    },
    highlight = {
      pattern = [[.*<((KEYWORDS)\s*(.*)?\s*:)]],
      multiline = false,
      after = "",
      keyword = "bg",
    },
}

Describe alternatives you've considered

  1. reverting to the builtin comment.scm and tree-sitter-comment
  2. Leave it as is.

Additional context

No response

aarondill avatar Aug 02 '24 22:08 aarondill

This is similar to the desired result (this is tree-sitter-comment): 2024-08-02_17-34

aarondill avatar Aug 02 '24 22:08 aarondill

@aarondill Hey, I am looking for this exact feature, how did u achieve what's in your screenshot?

Kyren223 avatar Aug 07 '24 16:08 Kyren223

@Kyren223, that screenshot is currently impossible to replicate with this plugin. If you want exactly that screenshot though, you can uninstall this plugin and install the typescript comment parser via :TSInstall comment

aarondill avatar Aug 07 '24 17:08 aarondill

@aarondill ah thx, I might end up forking this, I have wanted to have more customization for a while, like being able to specify both a bg and fg per section per type so I can have have 3 splits or even more for -- |TODO|(kyren)|: |text| (| used to indicate diff sections) EDIT: and then instead of color = it'd be color = { section = value1, section2 = value2 }

Kyren223 avatar Aug 07 '24 18:08 Kyren223

if you do, please open a PR to hopefully upstream those changes to the rest of us 😃

aarondill avatar Aug 07 '24 18:08 aarondill

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 07 '24 01:09 github-actions[bot]

not stale.

aarondill avatar Sep 07 '24 16:09 aarondill

@Kyren223 did you get anywhere with that?

aarondill avatar Sep 07 '24 16:09 aarondill

Currently I mostly use IntelliJ + IdeaVim (as I code in java), and for what I do in NeoVim (docs for the Java project) I don't really need this feature, so I haven't needed it. I might pick it up if my next project will use something like Rust where nvim is good at.

Kyren223 avatar Sep 07 '24 21:09 Kyren223

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 08 '24 02:10 github-actions[bot]

a comment a day keeps the stalebot away 😃

aarondill avatar Oct 08 '24 05:10 aarondill

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 09 '24 01:11 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Nov 16 '24 02:11 github-actions[bot]