zed
zed copied to clipboard
Inline git blame
This adds so-called "inline git blame" to the editor that, when turned on, shows git blame information about the current line inline:
When the inline information is hovered, a new tooltip appears that contains more information on the current commit:
The commit message in this tooltip is rendered as Markdown, is scrollable and clickable.
The tooltip is now also the tooltip used in the gutter:
Settings
The inline git blame information can be turned on and off via settings:
{
"git": {
"inline_blame": "on"
}
}
It can also be turned on/off for the current buffer with editor: toggle git blame inline.
To be done in follow-up PRs
- [ ] Add link to pull request in tooltip
- [ ] Add avatars of users if possible
Release notes
Release Notes:
- Added inline
git blameinformation the editor. It can be turned on in the settings with{"git": { "inline_blame": "on" } }for every buffer or, temporarily for the current buffer, witheditor: toggle git blame inline.
Great stuff. I don't want to disrupt anything you have going on here, but just posting a couple things I wonder about for the future:
- I really like inline blame tooltips, but don't tend to want to see it when moving throughout the code. I see a mention of "enable/disable", but assume that means a global on/off switch. I wonder if it would be possible to have a command allowing a keybinding to be assigned to display the tooltip similar to
g hforeditor::Hover. - "Add link to PR to tooltip" - This would be amazing to have at some point. As an aside, this is wayyyy outside the scope of this PR, but would generally like to be able to visit links in tooltips via keyboard.
Thanks, David!
- I wonder if it would be possible to have a command allowing a keybinding to be assigned to display the tooltip similar to
g hforeditor::Hover.
Yeah, that's a great idea, and we talked about it before: a push-to-talk kinda thing where you hold a key combination down and while it's down it shows the inline blame or something like that.
But before we do that, maybe we need global setting and a toggle keybinding, yeah.
This is cool, but is there a way to display it in the bottom toolbar (like VSCode). I pretty much never want to see it in the code itself.
No, there isn't right now.
All good, just wondering. I'd also be happy with the toggle hotkey baldwindavid mentioned above, so I'll throw a +1 behind that. As it is, it's too distracting so I just have it disabled. But I often want to know who wrote a function if I have questions about it, so it'd be super helpful to have a way to get this information on-demand.
@Tenkir you're probably aware but, if not, a bit of a workaround is to use the editor: toggle git blame command to pop open the blame only as needed rather than using "inline" blame at all. I have a keybinding to open/close that quickly.
{
"context": "Editor && VimControl && !VimWaiting && !menu",
"bindings": {
"space g l": "editor::ToggleGitBlame"
}
}
Hey! what is the relevant styling config for this feature? In my editor it shows up as super white, but I can't narrow down which config would change it
@jay-herrera it's using hint. You can override it like this:
{
"experimental.theme_overrides": {
"hint": "#fb4a35ff"
}
}