.emacs.d/init.d/programming/git.el

49 lines
1.5 KiB
EmacsLisp

;;; git.el --- magit and stuff. -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'basics/package-management)
(require 'basics/global-variables)
;; Git integration.
(use-package git-commit
:defer 2
:config (defun my/set-git-commit-fill-column ()
(setq-local fill-column 72))
:hook (git-commit-mode . my/set-git-commit-fill-column))
(use-package magit
:unless slow-computer
:after (keychain-environment)
:custom (magit-diff-refine-hunk 'all) ; Show word-granularity differences.
:bind (("C-x g" . nil) ; Disable default.
("C-c g" . magit-status)
("C-c M-g" . magit-dispatch)
(:map magit-hunk-section-map
("RET" . magit-diff-visit-worktree-file-other-window)))
:hook ((after-save . magit-after-save-refresh-status)
(magit-mode . keychain-refresh-environment)))
;; Use libgit rather than git.
(use-package magit-libgit
:after (magit))
;; Show TODOs in magit-status.
(use-package magit-todos
:after (magit)
:init (put 'magit-todos-depth 'safe-local-variable #'integerp)
:hook (magit-mode . magit-todos-mode))
;; Work with Git forges from Magit.
(use-package forge
:after (magit)
:config (add-to-list 'forge-alist
'("schlomp.space" "schlomp.space/api/v1"
"schlomp.space" forge-gitea-repository))
:hook (prog-mode . forge-bug-reference-setup))
(provide 'programming/git)
;;; git.el ends here