diff --git a/modules/ui/vc-gutter/README.org b/modules/ui/vc-gutter/README.org index 892a32a79..a199596ef 100644 --- a/modules/ui/vc-gutter/README.org +++ b/modules/ui/vc-gutter/README.org @@ -13,7 +13,13 @@ Supports Git, Svn, Hg, and Bzr. [[doom-contrib-maintainer:][Become a maintainer?]] ** Module flags -/This module has no flags./ +- +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). ** Packages - [[doom-package:][git-gutter-fringe]] diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index 3f0a30c20..fb51b2190 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -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 diff --git a/templates/init.example.el b/templates/init.example.el index 0ffd639db..f3041ec3b 100644 --- a/templates/init.example.el +++ b/templates/init.example.el @@ -46,7 +46,7 @@ ;;tabs ; a tab bar for Emacs ;;treemacs ; a project drawer, like neotree but cooler ;;unicode ; extended unicode support for various languages - vc-gutter ; vcs diff in the fringe + (vc-gutter +pretty) ; vcs diff in the fringe vi-tilde-fringe ; fringe tildes to mark beyond EOB ;;window-select ; visually switch windows workspaces ; tab emulation, persistence & separate workspaces