Skip to content

Add log margin popup #1715

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

lucasadelino
Copy link

@lucasadelino lucasadelino commented Apr 27, 2025

This is another attempt at adding author (and date) information to recent commits in the status buffer, following #653.

What currently works:

  • Toggling the visibility on/off (hides both author and date)
  • Cycling through three different date styles (relative date, abbreviated relative date, or an "ISO-like" format converted to the local timezone)
  • Toggling the author name on/off

I tried to follow Magit's default behavior as closely as I could. For the ISO-like date, I added a field to lib/git/log.lua to retrieve the commited date as a UNIX timestamp, which was then rendered in the local timezone. I think that should be fine, but if that introduces peformance concerns, or if there is a cleverer way to do this, I'm happy to change this.

What doesn't work yet
Pretty much all of the other features. Most notably:

  • Toggling shortstat
  • All of the popup arguments
  • The popup only works in the status buffer; in Magit, it also works in the log buffer
  • Magit also has a config setting to control what date (author or commit) is shown in the margins. Currently, only the commit date is shown.

I wanted to put this out here for preliminary feedback, but I still need to write some tests before this is ready to merge. After that, I'm happy to work on the missing features, be that before or after merging this initial implementation (maybe after, judging by the discussion in #653?).

A question
I used popup actions to implement the three features above. This was the closest Neogit correlate I found to mimick Magit, but I'm wondering if I have this right.

I think what's tripping me up is that these features seem more like switches than actions proper (for instance, these "actions" don't spawn any new buffers or popups), so mayble internal switches would be better here. Actions also seem to always close the popup, whereas the margin popup stays open in Magit (though we may also opt not to follow Magit's behavior). I may be overthinking this, but it was something I thought I should check anyway.

Happy to hear any thoughts on this; this the first time I've worked on a Neovim plugin, so any feedback is much appeciated!

@CKolkey
Copy link
Member

CKolkey commented May 2, 2025

A question
I used popup actions to implement the three features above. This was the closest Neogit correlate I found to mimick Magit, but I'm wondering if I have this right.

I think what's tripping me up is that these features seem more like switches than actions proper (for instance, these "actions" don't spawn any new buffers or popups), so mayble internal switches would be better here. Actions also seem to always close the popup, whereas the margin popup stays open in Magit (though we may also opt not to follow Magit's behavior). I may be overthinking this, but it was something I thought I should check anyway.

Yeah, for the time being, actions seem like the correct way to build this. The auto-close thing is not always ideal - for a while it wasn't an issue, but this isn't the first time it's been a limitation on desirable behavior. Maybe I can do something about that.

Overall this looks very reasonable to me!

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