Skip to content

✨feat(heading.background_eol): New option added. #94

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

Closed
wants to merge 1 commit into from
Closed

✨feat(heading.background_eol): New option added. #94

wants to merge 1 commit into from

Conversation

Zeioth
Copy link
Contributor

@Zeioth Zeioth commented Jul 24, 2024

The new option

heading = {
  background_eol = false
}

When set to false, it allow rendering the background until the end of the text, instead of until the end of the line:

screenshot_2024-07-24_21-24-52_639052097

Which again, it's really nice for people using vim.opt.colorcolumn.

@Zeioth
Copy link
Contributor Author

Zeioth commented Jul 24, 2024

It would be extra nice if we could specify width instead, but it seems this is not currently possible for nvim_buf_set_extmark().

@Zeioth Zeioth changed the title ✨feat(header.background_eol): Option added. ✨feat(header.background_eol): Option added. Jul 24, 2024
@Zeioth Zeioth changed the title ✨feat(header.background_eol): Option added. ✨feat(header.background_eol): New option added. Jul 24, 2024
@Zeioth Zeioth changed the title ✨feat(header.background_eol): New option added. ✨feat(heading.background_eol): New option added. Jul 24, 2024
@MeanderingProgrammer
Copy link
Owner

It would be extra nice if we could specify width instead, but it seems this is not currently possible for nvim_buf_set_extmark().

This is possible, but not directly via the vim API. Instead you would need to create 2 separate marks. One that highlights the text and another that starts after the text using virt_text_win_col and does an overlay with spaces to fill the remaining gap.

I think it makes sense to leave the door open for supporting a width or right_pad attribute in the future.

I don't think the background_eol argument would fit nicely with that. To keep some internal consistency can you follow the code configuration example and add a width field instead with values of full which would be for the current behavior & block for the new behavior.

Then the mark logic becomes: hl_eol = heading.width == 'full',.

Code block PR for reference: #88.

In the future we can add something like right_pad but not necessary in this PR.

@Zeioth
Copy link
Contributor Author

Zeioth commented Jul 25, 2024

If you wanna take it from here it's ok. Otherwise I can come back to it in a few days.

MeanderingProgrammer added a commit that referenced this pull request Jul 25, 2024
## Details

Currently headings always extend to the end of the current line.

Some users do not like that, to support this add a width attribute
with 2 values, 'full' & 'block'.

'full' behaves the same as now and extends the background to the end
of the line. 'block' on the other hand ends right after the text of
the heading.

Original PR: #94

Co-Authored-By: Zeioth <[email protected]>
@MeanderingProgrammer
Copy link
Owner

MeanderingProgrammer commented Jul 25, 2024

Cool, merged it here: 426b135.

Mostly just the rename to heading.width instead of heading.background_eol.

Thanks for the PR!

@MeanderingProgrammer
Copy link
Owner

left_pad, right_pad, and min_width have all been added as options for headings: 6392a5d

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

Successfully merging this pull request may close these issues.

2 participants