Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add module of manually highlighting several words? #1272

Open
2 tasks done
aidancz opened this issue Oct 11, 2024 · 1 comment
Open
2 tasks done

Add module of manually highlighting several words? #1272

aidancz opened this issue Oct 11, 2024 · 1 comment
Labels
new-module Request for the new module

Comments

@aidancz
Copy link

aidancz commented Oct 11, 2024

Contributing guidelines

Module(s)

new module

Description

I like to turn off the 'hlsearch' option, but I do need to highlight some strings to help me track variables

Different from syntax highlighting, this will make the highlighted part stand out more:

pic-selected-241011-1316-43

I am using this plugin: https://github.com/inkarkat/vim-mark
It works great, but it does not provide an operator, and I don’t like the default commands and keys, using vimscript makes it difficult to customize

Another plugin is https://github.com/pocco81/high-str.nvim
But it also does not provide an operator, and not using highlight groups is also a disadvantage

Are you interested in implementing this feature?

@aidancz aidancz added the feature-request Request for a feature to existing module label Oct 11, 2024
@echasnovski echasnovski added new-module Request for the new module and removed feature-request Request for a feature to existing module labels Oct 11, 2024
@echasnovski
Copy link
Owner

Thanks for the suggestion!

This indeed looks like an interesting functionality. One thing that makes me hesitant to adding this as a full module is that there is a built-in functionality that comes really close: :h :match. It can be used like :match MyHighlightGroup /\<buf_id\>/ to highlight in current window buf_id as a whole word with highlight group MyHighlightGroup. There are up to three such matches available (:2match and :3match).

The full "highlight based on motion/textobject" and "highlight visual selection" looks like a fairly small function wrapper away. If there is a need for more match highlights, there are matchadd() and matchdelete().

I'll think about it, but currently it looks like minor enough of a build on top of built-in functionality for users to include directly in the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-module Request for the new module
Projects
None yet
Development

No branches or pull requests

2 participants