refactor!(vc-gutter): move style defaults behind +pretty

BREAKING CHANGE: This changes moves its default configuration of the
fringe behind a +pretty flag. This won't cause breakage, but will cause
a (possibly unwanted) visual change: git-gutter will use its default
indicators (e.g. + and - symbols) instead of the continuous bars from
before.

To get back the old look, enable `+pretty` on the `:ui vc-gutter`
module.

This was done to make the defaults toggleable, to standardize +pretty,
to document issues with this customization that have been brought up by
members of the Emacs community, and to better document it in comments
for posterity.
This commit is contained in:
Henrik Lissner 2022-08-08 17:36:23 +02:00
parent 232e9d4b91
commit cd9bc5a1fd
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 41 additions and 2 deletions

View file

@ -16,6 +16,39 @@ This means subtle thin bitmaps on the left, an arrow bitmap for flycheck, and
flycheck indicators moved to the right fringe.")
;;
;;; Default styles
(when (featurep! +pretty)
;; UI: make the fringe small enough that the diff bars aren't too domineering,
;; while leaving enough room for other indicators.
(if (fboundp 'fringe-mode) (fringe-mode '8))
;; UI: the gutter looks less cramped with some space between it and buffer.
(setq-default fringes-outside-margins t)
;; STYLE: Redefine fringe bitmaps to take up only half the horizontal space in
;; the fringe. This way we avoid overbearingly large diff bars without having
;; to shrink the fringe and sacrifice precious space for other fringe
;; indicators (like flycheck or flyspell).
;; TODO Extract these into a package with faces that themes can target.
(after! git-gutter-fringe
(define-fringe-bitmap 'git-gutter-fr:added [224]
nil nil '(center repeated))
(define-fringe-bitmap 'git-gutter-fr:modified [224]
nil nil '(center repeated))
(define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240]
nil nil 'bottom))
;; FIX: To minimize overlap between flycheck indicators and git-gutter/diff-hl
;; indicators in the left fringe.
(after! flycheck
;; let diff have left fringe, flycheck can have right fringe
(setq flycheck-indication-mode 'right-fringe)
;; A non-descript, left-pointing arrow
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
[16 48 112 240 112 48 16] nil nil 'center)))
;;
;;; Packages