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

Commit message breaks highlighted cursor line #124

Open
Mo0rBy opened this issue Feb 22, 2024 · 5 comments
Open

Commit message breaks highlighted cursor line #124

Mo0rBy opened this issue Feb 22, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Mo0rBy
Copy link

Mo0rBy commented Feb 22, 2024

Hello!

I found this plugin while looking around for some gitblame plugins for nvim as I use LazyGit or plain old CLI commands for interacting with git and I didn't want to use something like fugitive.nvim just for the git blame features.

The main 2 plugins I found are this one and blamer.nvim. I prefer this plugin as it is a little more built up, but one major issue I have is that the virtual text for the git message disrupts the highlighted cursor line. I think this is best described with some screenshots.

Using the blamer.nvim plugin (and you can see this in the demo on it's Github page) the virtual text of the commit message is overlayed ontop of the highlighted cursor line:
Screenshot 2024-02-22 at 07 40 25

With this plugin, the virtual text looks like it has it's own textbox that breaks up the highlighted cursor line colour:
Screenshot 2024-02-22 at 07 43 02

The git blame implemented with the GitSigns plugin does this even better and has the virtual text look even more like in VSCode, which this git-blame.nvim and blamer.nvim plugins claim to be attempting to replicate:
Screenshot 2024-02-22 at 07 59 53
With this said, I still prefer the highlight group using the Comment colour as it makes the text pop out a bit more and is easier to read, and it's already very obvious that it's not a comment or part of the code I am reading.

Looking at the docs, I think this might be fixable by configuring the nvim_buf_set_extmark parameter, but I'm not entirely sure. I also think it would be better to ensure that the virtual text does not disrupt the highlighted cursor line by default.

@f-person f-person added the bug Something isn't working label Feb 29, 2024
@f-person
Copy link
Owner

Hi! This might be caused by git-blame.nvim having its own highlight group; consider setting it to the same one as your cursor line is, that should fix it :)
See https://github.com/f-person/git-blame.nvim?tab=readme-ov-file#highlight-group for more info

@Mo0rBy
Copy link
Author

Mo0rBy commented Feb 29, 2024

@f-person I tried a few different HighlightGroups but they all have the same effect of breaking up the background colour of the highlight line.

For the highlight groups that have a background colour defined, I would expect this to occur, but for the HighlightGroups that do not have a background, I would expect to keep the background as it should be. Here are some examples.

These first 2 DO NOT have a background colour defined:
Screenshot from 2024-02-29 21-30-42
Screenshot from 2024-02-29 21-31-16

This one DOES have a background colour (and quite an obvious one lol):
Screenshot from 2024-02-29 21-31-41

I definitely think this is something within this plugin as those others are able to do it and the default HighlightGroup used is Comment which definitely does not have a background colour as my cursorline highlight definitely works on comments:
Screenshot from 2024-02-29 21-35-59

@f-person
Copy link
Owner

Thanks for the detailed reply :)
I agree this is something we should definitely fix, but was suggesting setting the gitblame highlight group to the same one as your line indicator (or just setting the same background color) as a temporary workaround until the plugin has the fix :)

@Mo0rBy
Copy link
Author

Mo0rBy commented Feb 29, 2024

Ah right sorry, I misunderstood you there, but that makes sense as a quick workaround, thanks

@ruilya
Copy link

ruilya commented Apr 4, 2024

Can one give an example of a workaround? I don't understand what hl group should be set to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants