unblevable / quick-scope

Lightning fast left-right movement in Vim
MIT License
1.42k stars 54 forks source link

Disable on comments #54

Open francescoboc opened 4 years ago

francescoboc commented 4 years ago

Would it be possible to disable highlighting on commented lines?

IsaacElenbaas commented 4 years ago

: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.

bradford-smith94 commented 4 years ago

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.

IsaacElenbaas commented 4 years ago

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.

bradford-smith94 commented 4 years ago

Oh, I understand. Yes, you are correct.