quick-scope icon indicating copy to clipboard operation
quick-scope copied to clipboard

Disable on comments

Open francescoboc opened this issue 4 years ago • 4 comments

Would it be possible to disable highlighting on commented lines?

francescoboc avatar Mar 25 '20 14:03 francescoboc

:help matchadd

Syntax highlighting (see 'syntax') is a separate mechanism, and regardless of the chosen priority a match will always overrule syntax highlighting.

I can't think of a great workaround without autocommands to matchadd comments for every filetype.

IsaacElenbaas avatar May 09 '20 22:05 IsaacElenbaas

I don't think we'd need matchadd, we simply need to shortcircuit the function that adds the QuickScope highlights quick_scope#HighlightLine() seems like a good candidate. We would need a way to determine if the current line is within a comment.

We might be able to make use of :help comments or :help commentstring to detect if the current line is a comment, but I'm not exactly sure what that would look like right now.

bradford-smith94 avatar May 09 '20 23:05 bradford-smith94

apply_highlight_patterns uses matchadd, I'd meant we can't simply set the comment highlight group to a higher priority - we have to prevent highlighting them in the first place or matchadd comments back to how they should be.

IsaacElenbaas avatar May 09 '20 23:05 IsaacElenbaas

Oh, I understand. Yes, you are correct.

bradford-smith94 avatar May 09 '20 23:05 bradford-smith94