about summary refs log tree commit diff stats
path: root/emacs-prelude/personal/lisp/init-git.el
blob: 7bc19f19af84b06be1fa079a4fed615dd26b436f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(use-package magit
  :after key-chord
  :init
  (defun my/magit-set-upstream ()
    (interactive)
    (magit-shell-command-topdir "git upstream"))
  :config
  (key-chord-define-global "UU" 'my/magit-set-upstream)
  ;; prevent the git info on the modeline from becoming stale (based on code removed from doom modeline)
  :hook (magit-post-refresh .
    (lambda ()
      (dolist (buf (buffer-list))
        (when (and (not (buffer-modified-p buf))
                   (buffer-file-name buf)
                   (file-exists-p (buffer-file-name buf))
                   (file-in-directory-p (buffer-file-name buf) (magit-toplevel)))
          (with-current-buffer buf
            (vc-refresh-state)))))))

(prelude-require-package 'forge)
(use-package forge
  :after magit)

(provide 'init-git)