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

Make scope show_start / show_end highlight based #754

Open
jackcogdill opened this issue Oct 25, 2023 · 9 comments
Open

Make scope show_start / show_end highlight based #754

jackcogdill opened this issue Oct 25, 2023 · 9 comments
Labels
enhancement New feature or request

Comments

@jackcogdill
Copy link

Problem

The scope start/end can only be configured as underline or off.

Expected behavior

It would be more flexible for theming to support a highlight group (which could include underline by default). Underline is not suitable for my personal taste, but I would still like to have distinct highlighting for the scope start.

This used to be possible in version 2:

screenshot

@jackcogdill jackcogdill added the enhancement New feature or request label Oct 25, 2023
@lukas-reineke
Copy link
Owner

The scope underline highlights are automatically generated. It's not super trivial to add support for a separate option for this.

I'm not against merging a PR that adds this, but I don't think I will work on it.
If you want a workaround, you can overwrite the generated highlight groups yourself, it would be @ibl.scope.underline.N, where N is the scope index. If you only use one scope highlight group, it's always 1.

@jackcogdill
Copy link
Author

I was able to use the workaround, thanks.

require('ibl').setup(opts)
vim.cmd.highlight('clear @ibl.scope.underline.1')
vim.cmd.highlight('link @ibl.scope.underline.1 MyHighlightGroup')

For additional context, the underlines in my terminal / neovim setup follow the current text color. For individual terms this looks fine, but underlining an entire line looks bad. See screenshots below:

Default:
Screenshot 2023-10-26 at 10 51 23 AM

Workaround:
Screenshot 2023-10-26 at 10 51 40 AM

@lukas-reineke
Copy link
Owner

There is some discussion about the underline color in #686

@cd-a
Copy link

cd-a commented Jan 19, 2024

I was hoping it would work like in version 2 with highlight groups

@siduck
Copy link

siduck commented Mar 14, 2024

@lukas-reineke it works but if i set highlight group with my colorscheme which would happen before ibl.setup then ibl overrides it, shouldnt it be better to keep hlgroup untouched if its already set?

@lukas-reineke
Copy link
Owner

The @ibl highlight groups are internal. I will not officially support setting them manually, or add code to handle the case someone does.

@siduck
Copy link

siduck commented Mar 14, 2024

The @ibl highlight groups are internal. I will not officially support setting them manually, or add code to handle the case someone does.

oh, how do colorscheme plugins handle this then? most hlgroups load by default..

@lukas-reineke
Copy link
Owner

Setting a custom highlight group for scope start and end is not currently supported, that's why the issue is still open.

It's a compromise between making the setup that most people want as easy as possible, and supporting full customization.
I chose to make scope a single list of highlight groups, and the plugin creates all the necessary @ibl highlight groups automatically. This makes the setup much easier for the vast majority of users.
But this makes it currently hard to change the highlight to something other than underline.

Like I said, I'm not against adding support for this, if someone has a good idea how. Without compromising the simple setup.

@morhaham

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants