Update git-gutter when using magit

This commit is contained in:
Wojciech Kozlowski 2022-04-10 23:38:51 +02:00
parent 79e8a4d0e3
commit 0eabc99422

View File

@ -116,6 +116,19 @@
;; Additional coniguration for doom modules.
;; -----------------------------------------------------------------------------
;; Fix git-gutter advice for magit.
(after! (:all git-gutter magit)
;; Define a function that updates all visible buffers.
(defun +vc-gutter-update-visible-buffers-h (&rest _)
(save-excursion
(dolist (buffer (doom-visible-buffers) nil)
(with-current-buffer buffer
(+vc-gutter-update-h)))))
;; And add this as new advice to the magit functions.
(advice-add 'magit-stage :after #'+vc-gutter-update-visible-buffers-h)
(advice-add 'magit-unstage :after #'+vc-gutter-update-visible-buffers-h))
;; Disable hl-line-mode everywhere.
(after! hl-line (setq global-hl-line-modes nil))