Skip to main content

Module magit_blame_mode

Module magit_blame_mode 

Source
Expand description

MG.26b: magit-blame-mode — a minor mode that annotates the buffer you are already looking at.

Why this is not a buffer. The shape this replaces (*magit:blame:<path>*) rendered the file as text, one <sha> <author> <code> row per line. That is why blame lost syntax highlighting: the buffer stopped being the file, so there was no language and no parser, and blame_styled_spans returned nothing for the code column by construction. Every other editor checked — magit, fugitive, Zed, GitLens, JetBrains — annotates the real buffer, and highlighting survives because the file was never replaced. Design: [../../../docs/dev/architecture/magit-blame.md].

What it adds: one virtual row above each chunk of lines sharing a commit, carrying <sha> <author> <date> <summary> — magit’s headings style. Vertical cost instead of the horizontal cost a per-line column would impose, so the code stays exactly where the eye expects it and the commit is read once per chunk rather than truncated onto every line.

The buffer goes read-only while blaming, which is what re-frees <CR> and p for blame use. A minor on an editable file buffer cannot take grammar keys; magit resolves this the same way.

Structs§

BlameProvider
One virtual row above each blame chunk.
BlameRegistration
Drops the provider registration when the mode deactivates — the headings must go away with the blame, not outlive it.
BlameRequests
MG.26b: what a pending blame should be, keyed by the buffer name it will land on.
BlameState
MagitBlameMode

Enums§

BlameDirection
MG.23f2: which question this blame answers.

Constants§

MAGIT_BLAME_PROVIDER_ID
Provider id for the chunk-heading lane. One per buffer scope — a buffer has at most one blame running on it.

Type Aliases§

BlameRequestsHandle
BlameStatesHandle