refactor!(vc-gutter): drop git-gutter for diff-hl

BREAKING CHANGE: This removes git-gutter as an implementation for the
`:ui vc-gutter` module, leaving only the diff-hl implementation. There
are no longer any +git-gutter or +diff-hl flags for this module. Users
don't have to do anything to keep the vc gutter, unless they prefer
git-gutter for any reason (in which case they'll need to install and set
it up themselves).

This has been planned for some time, because of a roadmap goal for Doom
to lean into native/built-in functionality where it's equal or better
than the third party alternatives. diff-hl relies on the built-in vc.el
library instead of talking to git directly (thus expanding support to
whatever VCS's vc.el supports, and not git alone), which also means it
can take advantage of its caching and other user configuration for
vc.el. Overall, it is faster and lighter.

What I've also been waiting for was a stage-hunk command, similar to
git-gutter:stage-hunk, which arrived in dgutov/diff-hl@a0560551cd and
dgutov/diff-hl@133538973b, and have evolved since.

Ref: dgutov/diff-hl@a0560551cd
Ref: dgutov/diff-hl@133538973b
Ref: https://github.com/orgs/doomemacs/projects/5/views/1?pane=issue&itemId=58747789
This commit is contained in:
Henrik Lissner 2024-06-22 17:13:20 -04:00
parent 0aede16322
commit b405225b90
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
16 changed files with 69 additions and 191 deletions

View file

@ -13,44 +13,32 @@ Supports Git, Svn, Hg, and Bzr.
[[doom-contrib-maintainer:][Become a maintainer?]]
** Module flags
- +diff-hl ::
Use [[doom-package:diff-hl]] instead of git-gutter to power the VC gutter. It is a little
faster, but is slightly more prone to visual glitching. [[doom-package:diff-hl]] is intended to
replace git-gutter at some point in the future.
- +pretty ::
Apply some stylistic defaults to the fringe, enabling thin bars in the fringe.
This look takes after the modern look of git-gutter in VSCode and Sublime
Text, without sacrificing on fringe width (which squeeze other indicators,
like flycheck's, flymake's, or flyspell's). However, this will look bad with
themes that invert the foreground/background of either git-gutter's or
diff-hl's faces (like modus-themes does).
Apply some stylistic defaults to the fringe that present the diff in the
fringe as thin bars, taking after the modern look of the git-gutter plugin in
VSCode and Sublime Text. However, this will look bad with themes that invert
the foreground/background of diff-hl's faces (like modus-themes does).
** Packages
- [[doom-package:git-gutter-fringe]] unless [[doom-module:+diff-hl]]
- [[doom-package:diff-hl]] if [[doom-module:+diff-hl]]
- [[doom-package:diff-hl]]
** Hacks
- The VC gutter will be updated when pressing ESC, leaving insert mode (evil
users), or refocusing the frame or window where it is active.
- If [[doom-module:+pretty]] is enabled
- The fringes that both git-gutter-fringe and diff-hl define will be replaced
with a set of thin bars. This achieves a slicker look closer to git-gutter's
appearance in VSCode or Sublime Text, but may look weird for themes that
swap their faces' :foreground and :background (like modus-themes).
- The fringes that diff-hl define will be replaced with a set of thin bars.
This achieves a slicker look closer to git-gutter's appearance in VSCode or
Sublime Text, but may look weird for themes that swap their faces'
:foreground and :background (like modus-themes).
- The fringes are moved to the outside of the margins (closest to the frame
edge), so they have some breathing space away from the buffer's contents.
- If [[doom-package:+diff-hl]] is enabled:
- ~diff-hl-revert-hunk~ displays a preview popup of the hunk being reverted.
It takes up ~50% of the frame, by default, whether you're reverting 2 lines
or 20. Since this isn't easily customized, it has been advised to shrink
this popup to the side of its contents.
- ~diff-hl-revert-hunk~ will sometimes move the cursor to an unexpected
location (the bounds of hunks, is my guess), but this is not intuitive and
often unexpected. Cursor movements have been suppressed for it.
- If +diff-hl is *not* enabled:
- Sometimes, ~git-gutter:next-hunk~ and ~git-gutter:previous-hunk~ get
confused about the order of hunks. They have been advised to fix this
(although the hack is a little inefficient).
- ~diff-hl-revert-hunk~ displays a preview popup of the hunk being reverted.
It takes up ~50% of the frame, by default, whether you're reverting 2 lines
or 20. Since this isn't easily customized, it has been advised to shrink
this popup to the side of its contents.
- ~diff-hl-revert-hunk~ will sometimes move the cursor to an unexpected
location (the bounds of hunks, is my guess), but this is not intuitive and
often unexpected. Cursor movements have been suppressed for it.
** TODO Changelog
# This section will be machine generated. Don't edit it by hand.